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