xref: /dflybsd-src/contrib/gcc-8.0/gcc/explow.h (revision 38fd149817dfbff97799f62fcb70be98c4e32523)
1*38fd1498Szrj /* Export function prototypes from explow.c.
2*38fd1498Szrj    Copyright (C) 2015-2018 Free Software Foundation, Inc.
3*38fd1498Szrj 
4*38fd1498Szrj This file is part of GCC.
5*38fd1498Szrj 
6*38fd1498Szrj GCC is free software; you can redistribute it and/or modify it under
7*38fd1498Szrj the terms of the GNU General Public License as published by the Free
8*38fd1498Szrj Software Foundation; either version 3, or (at your option) any later
9*38fd1498Szrj version.
10*38fd1498Szrj 
11*38fd1498Szrj GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12*38fd1498Szrj WARRANTY; without even the implied warranty of MERCHANTABILITY or
13*38fd1498Szrj FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14*38fd1498Szrj for more details.
15*38fd1498Szrj 
16*38fd1498Szrj You should have received a copy of the GNU General Public License
17*38fd1498Szrj along with GCC; see the file COPYING3.  If not see
18*38fd1498Szrj <http://www.gnu.org/licenses/>.  */
19*38fd1498Szrj 
20*38fd1498Szrj #ifndef GCC_EXPLOW_H
21*38fd1498Szrj #define GCC_EXPLOW_H
22*38fd1498Szrj 
23*38fd1498Szrj /* Return a memory reference like MEMREF, but which is known to have a
24*38fd1498Szrj    valid address.  */
25*38fd1498Szrj extern rtx validize_mem (rtx);
26*38fd1498Szrj 
27*38fd1498Szrj extern rtx use_anchored_address (rtx);
28*38fd1498Szrj 
29*38fd1498Szrj /* Copy given rtx to a new temp reg and return that.  */
30*38fd1498Szrj extern rtx copy_to_reg (rtx);
31*38fd1498Szrj 
32*38fd1498Szrj /* Like copy_to_reg but always make the reg Pmode.  */
33*38fd1498Szrj extern rtx copy_addr_to_reg (rtx);
34*38fd1498Szrj 
35*38fd1498Szrj /* Like copy_to_reg but always make the reg the specified mode MODE.  */
36*38fd1498Szrj extern rtx copy_to_mode_reg (machine_mode, rtx);
37*38fd1498Szrj 
38*38fd1498Szrj /* Copy given rtx to given temp reg and return that.  */
39*38fd1498Szrj extern rtx copy_to_suggested_reg (rtx, rtx, machine_mode);
40*38fd1498Szrj 
41*38fd1498Szrj /* Copy a value to a register if it isn't already a register.
42*38fd1498Szrj    Args are mode (in case value is a constant) and the value.  */
43*38fd1498Szrj extern rtx force_reg (machine_mode, rtx);
44*38fd1498Szrj 
45*38fd1498Szrj /* Return given rtx, copied into a new temp reg if it was in memory.  */
46*38fd1498Szrj extern rtx force_not_mem (rtx);
47*38fd1498Szrj 
48*38fd1498Szrj /* Return mode and signedness to use when an argument or result in the
49*38fd1498Szrj    given mode is promoted.  */
50*38fd1498Szrj extern machine_mode promote_function_mode (const_tree, machine_mode, int *,
51*38fd1498Szrj 					        const_tree, int);
52*38fd1498Szrj 
53*38fd1498Szrj /* Return mode and signedness to use when an object in the given mode
54*38fd1498Szrj    is promoted.  */
55*38fd1498Szrj extern machine_mode promote_mode (const_tree, machine_mode, int *);
56*38fd1498Szrj 
57*38fd1498Szrj /* Return mode and signedness to use when object is promoted.  */
58*38fd1498Szrj machine_mode promote_decl_mode (const_tree, int *);
59*38fd1498Szrj 
60*38fd1498Szrj /* Return mode and signedness to use when object is promoted.  */
61*38fd1498Szrj machine_mode promote_ssa_mode (const_tree, int *);
62*38fd1498Szrj 
63*38fd1498Szrj /* Remove some bytes from the stack.  An rtx says how many.  */
64*38fd1498Szrj extern void adjust_stack (rtx);
65*38fd1498Szrj 
66*38fd1498Szrj /* Add some bytes to the stack.  An rtx says how many.  */
67*38fd1498Szrj extern void anti_adjust_stack (rtx);
68*38fd1498Szrj 
69*38fd1498Szrj /* Add some bytes to the stack while probing it.  An rtx says how many. */
70*38fd1498Szrj extern void anti_adjust_stack_and_probe (rtx, bool);
71*38fd1498Szrj 
72*38fd1498Szrj /* Support for building allocation/probing loops for stack-clash
73*38fd1498Szrj    protection of dyamically allocated stack space.  */
74*38fd1498Szrj extern void compute_stack_clash_protection_loop_data (rtx *, rtx *, rtx *,
75*38fd1498Szrj 						      HOST_WIDE_INT *, rtx);
76*38fd1498Szrj extern void emit_stack_clash_protection_probe_loop_start (rtx *, rtx *,
77*38fd1498Szrj 							  rtx, bool);
78*38fd1498Szrj extern void emit_stack_clash_protection_probe_loop_end (rtx, rtx,
79*38fd1498Szrj 							rtx, bool);
80*38fd1498Szrj 
81*38fd1498Szrj /* This enum is used for the following two functions.  */
82*38fd1498Szrj enum save_level {SAVE_BLOCK, SAVE_FUNCTION, SAVE_NONLOCAL};
83*38fd1498Szrj 
84*38fd1498Szrj /* Save the stack pointer at the specified level.  */
85*38fd1498Szrj extern void emit_stack_save (enum save_level, rtx *);
86*38fd1498Szrj 
87*38fd1498Szrj /* Restore the stack pointer from a save area of the specified level.  */
88*38fd1498Szrj extern void emit_stack_restore (enum save_level, rtx);
89*38fd1498Szrj 
90*38fd1498Szrj /* Invoke emit_stack_save for the nonlocal_goto_save_area.  */
91*38fd1498Szrj extern void update_nonlocal_goto_save_area (void);
92*38fd1498Szrj 
93*38fd1498Szrj /* Record a new stack level.  */
94*38fd1498Szrj extern void record_new_stack_level (void);
95*38fd1498Szrj 
96*38fd1498Szrj /* Allocate some space on the stack dynamically and return its address.  */
97*38fd1498Szrj extern rtx allocate_dynamic_stack_space (rtx, unsigned, unsigned,
98*38fd1498Szrj 					 HOST_WIDE_INT, bool);
99*38fd1498Szrj 
100*38fd1498Szrj /* Calculate the necessary size of a constant dynamic stack allocation from the
101*38fd1498Szrj    size of the variable area.  */
102*38fd1498Szrj extern void get_dynamic_stack_size (rtx *, unsigned, unsigned, HOST_WIDE_INT *);
103*38fd1498Szrj 
104*38fd1498Szrj /* Returns the address of the dynamic stack space without allocating it.  */
105*38fd1498Szrj extern rtx get_dynamic_stack_base (poly_int64, unsigned);
106*38fd1498Szrj 
107*38fd1498Szrj /* Emit one stack probe at ADDRESS, an address within the stack.  */
108*38fd1498Szrj extern void emit_stack_probe (rtx);
109*38fd1498Szrj 
110*38fd1498Szrj /* Probe a range of stack addresses from FIRST to FIRST+SIZE, inclusive.
111*38fd1498Szrj    FIRST is a constant and size is a Pmode RTX.  These are offsets from
112*38fd1498Szrj    the current stack pointer.  STACK_GROWS_DOWNWARD says whether to add
113*38fd1498Szrj    or subtract them from the stack pointer.  */
114*38fd1498Szrj extern void probe_stack_range (HOST_WIDE_INT, rtx);
115*38fd1498Szrj 
116*38fd1498Szrj /* Return an rtx that refers to the value returned by a library call
117*38fd1498Szrj    in its original home.  This becomes invalid if any more code is emitted.  */
118*38fd1498Szrj extern rtx hard_libcall_value (machine_mode, rtx);
119*38fd1498Szrj 
120*38fd1498Szrj /* Return an rtx that refers to the value returned by a function
121*38fd1498Szrj    in its original home.  This becomes invalid if any more code is emitted.  */
122*38fd1498Szrj extern rtx hard_function_value (const_tree, const_tree, const_tree, int);
123*38fd1498Szrj 
124*38fd1498Szrj /* Convert arg to a valid memory address for specified machine mode that points
125*38fd1498Szrj    to a specific named address space, by emitting insns to perform arithmetic
126*38fd1498Szrj    if necessary.  */
127*38fd1498Szrj extern rtx memory_address_addr_space (machine_mode, rtx, addr_space_t);
128*38fd1498Szrj 
129*38fd1498Szrj extern rtx eliminate_constant_term (rtx, rtx *);
130*38fd1498Szrj 
131*38fd1498Szrj /* Like memory_address_addr_space, except assume the memory address points to
132*38fd1498Szrj    the generic named address space.  */
133*38fd1498Szrj #define memory_address(MODE,RTX) \
134*38fd1498Szrj 	memory_address_addr_space ((MODE), (RTX), ADDR_SPACE_GENERIC)
135*38fd1498Szrj 
136*38fd1498Szrj #endif /* GCC_EXPLOW_H */
137