]>
Commit | Line | Data |
---|---|---|
bf6beae5 | 1 | /* Structure for saving state for a nested function. |
8d9254fc | 2 | Copyright (C) 1989-2020 Free Software Foundation, Inc. |
bf6beae5 | 3 | |
1322177d | 4 | This file is part of GCC. |
bf6beae5 | 5 | |
1322177d LB |
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 | |
9dcd6f09 | 8 | Software Foundation; either version 3, or (at your option) any later |
1322177d | 9 | version. |
bf6beae5 | 10 | |
1322177d LB |
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. | |
bf6beae5 CH |
15 | |
16 | You should have received a copy of the GNU General Public License | |
9dcd6f09 NC |
17 | along with GCC; see the file COPYING3. If not see |
18 | <http://www.gnu.org/licenses/>. */ | |
bf6beae5 | 19 | |
264fa2db ZL |
20 | #ifndef GCC_FUNCTION_H |
21 | #define GCC_FUNCTION_H | |
beb32b59 | 22 | |
90f90283 | 23 | |
bf6beae5 CH |
24 | /* Stack of pending (incomplete) sequences saved by `start_sequence'. |
25 | Each element describes one pending sequence. | |
26 | The main insn-chain is saved in the last element of the chain, | |
27 | unless the chain is empty. */ | |
28 | ||
d1b38208 | 29 | struct GTY(()) sequence_stack { |
bf6beae5 | 30 | /* First and last insns in the chain of the saved sequence. */ |
0926539c DM |
31 | rtx_insn *first; |
32 | rtx_insn *last; | |
bf6beae5 CH |
33 | struct sequence_stack *next; |
34 | }; | |
bf6beae5 | 35 | \f |
d1b38208 | 36 | struct GTY(()) emit_status { |
f44986d7 DM |
37 | void ensure_regno_capacity (); |
38 | ||
49ad7cfa BS |
39 | /* This is reset to LAST_VIRTUAL_REGISTER + 1 at the start of each function. |
40 | After rtl generation, it is 1 plus the largest register number used. */ | |
41 | int x_reg_rtx_no; | |
42 | ||
43 | /* Lowest label number in current function. */ | |
44 | int x_first_label_num; | |
45 | ||
614d5bd8 AM |
46 | /* seq.first and seq.last are the ends of the doubly-linked chain of |
47 | rtl for the current function. Both are reset to null at the | |
48 | start of rtl generation for the function. | |
fa8db1f7 | 49 | |
614d5bd8 AM |
50 | start_sequence saves both of these on seq.next and then starts |
51 | a new, nested sequence of insns. | |
49ad7cfa | 52 | |
614d5bd8 AM |
53 | seq.next is a stack of pending (incomplete) sequences saved by |
54 | start_sequence. Each element describes one pending sequence. | |
55 | The main insn-chain is the last element of the chain. */ | |
56 | struct sequence_stack seq; | |
49ad7cfa BS |
57 | |
58 | /* INSN_UID for next insn emitted. | |
59 | Reset to 1 for each function compiled. */ | |
60 | int x_cur_insn_uid; | |
61 | ||
b5b8b0ac AO |
62 | /* INSN_UID for next debug insn emitted. Only used if |
63 | --param min-nondebug-insn-uid=<value> is given with nonzero value. */ | |
64 | int x_cur_debug_insn_uid; | |
65 | ||
0d4903b8 RK |
66 | /* The length of the regno_pointer_align, regno_decl, and x_regno_reg_rtx |
67 | vectors. Since these vectors are needed during the expansion phase when | |
68 | the total number of registers in the function is not yet known, the | |
69 | vectors are copied and made bigger when necessary. */ | |
3502dc9c | 70 | int regno_pointer_align_length; |
49ad7cfa BS |
71 | |
72 | /* Indexed by pseudo register number, if nonzero gives the known alignment | |
3502dc9c JDA |
73 | for that pseudo (if REG_POINTER is set in x_regno_reg_rtx). |
74 | Allocated in parallel with x_regno_reg_rtx. */ | |
bd60bab2 | 75 | unsigned char * GTY((skip)) regno_pointer_align; |
49ad7cfa BS |
76 | }; |
77 | ||
bd60bab2 | 78 | |
35aebd56 RS |
79 | /* Indexed by register number, gives an rtx for that register (and only |
80 | that register). For pseudo registers, it is the unique rtx for | |
81 | that pseudo. For hard registers, it is an rtx of the mode specified | |
82 | by reg_raw_mode. | |
83 | ||
84 | FIXME: We could put it into emit_status struct, but gengtype is not | |
85 | able to deal with length attribute nested in top level structures. */ | |
bd60bab2 | 86 | |
3e029763 | 87 | extern GTY ((length ("crtl->emit.x_reg_rtx_no"))) rtx * regno_reg_rtx; |
bd60bab2 | 88 | |
49ad7cfa | 89 | /* For backward compatibility... eventually these should all go away. */ |
3e029763 | 90 | #define reg_rtx_no (crtl->emit.x_reg_rtx_no) |
49ad7cfa | 91 | |
3e029763 | 92 | #define REGNO_POINTER_ALIGN(REGNO) (crtl->emit.regno_pointer_align[REGNO]) |
49ad7cfa | 93 | |
d1b38208 | 94 | struct GTY(()) expr_status { |
49ad7cfa BS |
95 | /* Number of units that we should eventually pop off the stack. |
96 | These are the arguments to function calls that have already returned. */ | |
a20c5714 | 97 | poly_int64_pod x_pending_stack_adjust; |
49ad7cfa BS |
98 | |
99 | /* Under some ABIs, it is the caller's responsibility to pop arguments | |
100 | pushed for function calls. A naive implementation would simply pop | |
101 | the arguments immediately after each call. However, if several | |
102 | function calls are made in a row, it is typically cheaper to pop | |
103 | all the arguments after all of the calls are complete since a | |
104 | single pop instruction can be used. Therefore, GCC attempts to | |
105 | defer popping the arguments until absolutely necessary. (For | |
106 | example, at the end of a conditional, the arguments must be popped, | |
107 | since code outside the conditional won't know whether or not the | |
108 | arguments need to be popped.) | |
109 | ||
cc2902df | 110 | When INHIBIT_DEFER_POP is nonzero, however, the compiler does not |
49ad7cfa BS |
111 | attempt to defer pops. Instead, the stack is popped immediately |
112 | after each call. Rather then setting this variable directly, use | |
113 | NO_DEFER_POP and OK_DEFER_POP. */ | |
114 | int x_inhibit_defer_pop; | |
115 | ||
1503a7ec | 116 | /* If PREFERRED_STACK_BOUNDARY and PUSH_ROUNDING are defined, the stack |
98ef4163 | 117 | boundary can be momentarily unaligned while pushing the arguments. |
1503a7ec JH |
118 | Record the delta since last aligned boundary here in order to get |
119 | stack alignment in the nested function calls working right. */ | |
a20c5714 | 120 | poly_int64_pod x_stack_pointer_delta; |
1503a7ec | 121 | |
49ad7cfa BS |
122 | /* Nonzero means __builtin_saveregs has already been done in this function. |
123 | The value is the pseudoreg containing the value __builtin_saveregs | |
124 | returned. */ | |
125 | rtx x_saveregs_value; | |
126 | ||
127 | /* Similarly for __builtin_apply_args. */ | |
128 | rtx x_apply_args_value; | |
129 | ||
130 | /* List of labels that must never be deleted. */ | |
6f7eba34 | 131 | vec<rtx_insn *, va_gc> *x_forced_labels; |
49ad7cfa BS |
132 | }; |
133 | ||
7e5487a2 | 134 | typedef struct call_site_record_d *call_site_record; |
69c32ec8 JH |
135 | |
136 | /* RTL representation of exception handling. */ | |
d1b38208 | 137 | struct GTY(()) rtl_eh { |
69c32ec8 JH |
138 | rtx ehr_stackadj; |
139 | rtx ehr_handler; | |
f8b23302 | 140 | rtx_code_label *ehr_label; |
69c32ec8 JH |
141 | |
142 | rtx sjlj_fc; | |
f8b23302 | 143 | rtx_insn *sjlj_exit_after; |
69c32ec8 | 144 | |
9771b263 | 145 | vec<uchar, va_gc> *action_record_data; |
69c32ec8 | 146 | |
9771b263 | 147 | vec<call_site_record, va_gc> *call_site_record_v[2]; |
69c32ec8 JH |
148 | }; |
149 | ||
3e029763 JH |
150 | #define pending_stack_adjust (crtl->expr.x_pending_stack_adjust) |
151 | #define inhibit_defer_pop (crtl->expr.x_inhibit_defer_pop) | |
152 | #define saveregs_value (crtl->expr.x_saveregs_value) | |
153 | #define apply_args_value (crtl->expr.x_apply_args_value) | |
154 | #define forced_labels (crtl->expr.x_forced_labels) | |
155 | #define stack_pointer_delta (crtl->expr.x_stack_pointer_delta) | |
49ad7cfa | 156 | |
5cd4ec7f | 157 | struct gimple_df; |
7e5487a2 | 158 | struct call_site_record_d; |
84562394 | 159 | struct dw_fde_node; |
6370682a | 160 | |
d1b38208 | 161 | struct GTY(()) varasm_status { |
bd60bab2 JH |
162 | /* If we're using a per-function constant pool, this is it. */ |
163 | struct rtx_constant_pool *pool; | |
164 | ||
165 | /* Number of tree-constants deferred during the expansion of this | |
166 | function. */ | |
167 | unsigned int deferred_constants; | |
168 | }; | |
169 | ||
38173d38 JH |
170 | |
171 | /* Data for function partitioning. */ | |
d1b38208 | 172 | struct GTY(()) function_subsections { |
38173d38 JH |
173 | /* Assembly labels for the hot and cold text sections, to |
174 | be used by debugger functions for determining the size of text | |
175 | sections. */ | |
176 | ||
177 | const char *hot_section_label; | |
178 | const char *cold_section_label; | |
179 | const char *hot_section_end_label; | |
180 | const char *cold_section_end_label; | |
38173d38 JH |
181 | }; |
182 | ||
56731d64 BS |
183 | /* Describe an empty area of space in the stack frame. These can be chained |
184 | into a list; this is used to keep track of space wasted for alignment | |
185 | reasons. */ | |
6c1dae73 | 186 | class GTY(()) frame_space |
56731d64 | 187 | { |
6c1dae73 | 188 | public: |
99b1c316 | 189 | class frame_space *next; |
56731d64 | 190 | |
f075bd95 RS |
191 | poly_int64 start; |
192 | poly_int64 length; | |
56731d64 BS |
193 | }; |
194 | ||
c013852d | 195 | /* Describe emitted calls for -fcallgraph-info. */ |
3cf3da88 EB |
196 | struct GTY(()) callinfo_callee |
197 | { | |
198 | location_t location; | |
199 | tree decl; | |
200 | }; | |
3cf3da88 EB |
201 | |
202 | /* Describe dynamic allocation for -fcallgraph-info=da. */ | |
203 | struct GTY(()) callinfo_dalloc | |
204 | { | |
205 | location_t location; | |
206 | char const *name; | |
207 | }; | |
208 | ||
6c1dae73 | 209 | class GTY(()) stack_usage |
d3c12306 | 210 | { |
6c1dae73 | 211 | public: |
d3c12306 EB |
212 | /* # of bytes of static stack space allocated by the function. */ |
213 | HOST_WIDE_INT static_stack_size; | |
214 | ||
215 | /* # of bytes of dynamic stack space allocated by the function. This is | |
216 | meaningful only if has_unbounded_dynamic_stack_size is zero. */ | |
217 | HOST_WIDE_INT dynamic_stack_size; | |
218 | ||
a20c5714 RS |
219 | /* Upper bound on the number of bytes pushed onto the stack after the |
220 | prologue. If !ACCUMULATE_OUTGOING_ARGS, it contains the outgoing | |
221 | arguments. */ | |
222 | poly_int64 pushed_stack_size; | |
d3c12306 | 223 | |
d3c12306 EB |
224 | /* Nonzero if the amount of stack space allocated dynamically cannot |
225 | be bounded at compile-time. */ | |
226 | unsigned int has_unbounded_dynamic_stack_size : 1; | |
3cf3da88 EB |
227 | |
228 | /* Functions called within the function, if callgraph is enabled. */ | |
229 | vec<callinfo_callee, va_gc> *callees; | |
230 | ||
231 | /* Dynamic allocations encountered within the function, if callgraph | |
232 | da is enabled. */ | |
233 | vec<callinfo_dalloc, va_gc> *dallocs; | |
d3c12306 EB |
234 | }; |
235 | ||
236 | #define current_function_static_stack_size (cfun->su->static_stack_size) | |
237 | #define current_function_dynamic_stack_size (cfun->su->dynamic_stack_size) | |
238 | #define current_function_pushed_stack_size (cfun->su->pushed_stack_size) | |
d3c12306 EB |
239 | #define current_function_has_unbounded_dynamic_stack_size \ |
240 | (cfun->su->has_unbounded_dynamic_stack_size) | |
241 | #define current_function_allocates_dynamic_stack_space \ | |
242 | (current_function_dynamic_stack_size != 0 \ | |
243 | || current_function_has_unbounded_dynamic_stack_size) | |
244 | ||
bf6beae5 CH |
245 | /* This structure can save all the important global and static variables |
246 | describing the status of the current function. */ | |
247 | ||
d1b38208 | 248 | struct GTY(()) function { |
b384405b BS |
249 | struct eh_status *eh; |
250 | ||
997de8ed SB |
251 | /* The control flow graph for this function. */ |
252 | struct control_flow_graph *cfg; | |
726a989a RB |
253 | |
254 | /* GIMPLE body for this function. */ | |
355a7673 | 255 | gimple_seq gimple_body; |
726a989a | 256 | |
5cd4ec7f JH |
257 | /* SSA and dataflow information. */ |
258 | struct gimple_df *gimple_df; | |
997de8ed | 259 | |
598ec7bd | 260 | /* The loops in this function. */ |
9e2f83a5 | 261 | struct loops *x_current_loops; |
598ec7bd | 262 | |
c2e84327 | 263 | /* Filled by the GIMPLE and RTL FEs, pass to start compilation with. */ |
1ee62b92 PG |
264 | char *pass_startwith; |
265 | ||
d3c12306 | 266 | /* The stack usage of this function. */ |
99b1c316 | 267 | class stack_usage *su; |
d3c12306 | 268 | |
6946b3f7 JH |
269 | /* Value histograms attached to particular statements. */ |
270 | htab_t GTY((skip)) value_histograms; | |
271 | ||
bf6beae5 | 272 | /* For function.c. */ |
49ad7cfa | 273 | |
19eb1ad7 | 274 | /* Points to the FUNCTION_DECL of this function. */ |
bf6beae5 | 275 | tree decl; |
49ad7cfa | 276 | |
1a837f77 | 277 | /* A PARM_DECL that should contain the static chain for this function. |
6de9cd9a DN |
278 | It will be initialized at the beginning of the function. */ |
279 | tree static_chain_decl; | |
49ad7cfa | 280 | |
6de9cd9a | 281 | /* An expression that contains the non-local goto save area. The first |
b8698a0f | 282 | word is the saved frame pointer and the second is the saved stack |
6de9cd9a DN |
283 | pointer. */ |
284 | tree nonlocal_goto_save_area; | |
49ad7cfa | 285 | |
c021f10b | 286 | /* Vector of function local variables, functions, types and constants. */ |
9771b263 | 287 | vec<tree, va_gc> *local_decls; |
cb91fab0 | 288 | |
bf6beae5 | 289 | /* For md files. */ |
49ad7cfa | 290 | |
d6e1b011 | 291 | /* tm.h can use this to store whatever it likes. */ |
1431042e | 292 | struct machine_function * GTY ((maybe_undef)) machine; |
55dea919 | 293 | |
8c5666b4 | 294 | /* Language-specific code can use this to store whatever it likes. */ |
e2500fed | 295 | struct language_function * language; |
8c5666b4 | 296 | |
33c9159e | 297 | /* Used types hash table. */ |
b086d530 | 298 | hash_set<tree> *GTY (()) used_types_hash; |
33c9159e | 299 | |
a518b996 RH |
300 | /* Dwarf2 Frame Description Entry, containing the Call Frame Instructions |
301 | used for unwinding. Only set when either dwarf2 unwinding or dwarf2 | |
302 | debugging is enabled. */ | |
84562394 | 303 | struct dw_fde_node *fde; |
a518b996 | 304 | |
908ff6a3 KZ |
305 | /* Last statement uid. */ |
306 | int last_stmt_uid; | |
307 | ||
96a95ac1 AO |
308 | /* Debug marker counter. Count begin stmt markers. We don't have |
309 | to keep it exact, it's more of a rough estimate to enable us to | |
310 | decide whether they are too many to copy during inlining, or when | |
311 | expanding to RTL. */ | |
312 | int debug_marker_count; | |
313 | ||
3691626c RG |
314 | /* Function sequence number for profiling, debugging, etc. */ |
315 | int funcdef_no; | |
316 | ||
1751ecd6 AH |
317 | /* Line number of the start of the function for debugging purposes. */ |
318 | location_t function_start_locus; | |
319 | ||
6de9cd9a DN |
320 | /* Line number of the end of the function. */ |
321 | location_t function_end_locus; | |
322 | ||
a5093353 JH |
323 | /* Properties used by the pass manager. */ |
324 | unsigned int curr_properties; | |
325 | unsigned int last_verified; | |
27dbd3ac | 326 | |
27dbd3ac RH |
327 | /* Non-null if the function does something that would prevent it from |
328 | being copied; this applies to both versioning and inlining. Set to | |
329 | a string describing the reason for failure. */ | |
330 | const char * GTY((skip)) cannot_be_copied_reason; | |
331 | ||
f3dccf50 RB |
332 | /* Last assigned dependence info clique. */ |
333 | unsigned short last_clique; | |
334 | ||
89996b6e RH |
335 | /* Collected bit flags. */ |
336 | ||
ecaebb9e NS |
337 | /* Number of units of general registers that need saving in stdarg |
338 | function. What unit is depends on the backend, either it is number | |
339 | of bytes, or it can be number of registers. */ | |
340 | unsigned int va_list_gpr_size : 8; | |
341 | ||
342 | /* Number of units of floating point registers that need saving in stdarg | |
343 | function. */ | |
344 | unsigned int va_list_fpr_size : 8; | |
345 | ||
89996b6e RH |
346 | /* Nonzero if function being compiled can call setjmp. */ |
347 | unsigned int calls_setjmp : 1; | |
348 | ||
89996b6e RH |
349 | /* Nonzero if function being compiled can call alloca, |
350 | either as a subroutine or builtin. */ | |
351 | unsigned int calls_alloca : 1; | |
352 | ||
500e4868 JJ |
353 | /* Nonzero if function being compiled can call __builtin_eh_return. */ |
354 | unsigned int calls_eh_return : 1; | |
355 | ||
89996b6e RH |
356 | /* Nonzero if function being compiled receives nonlocal gotos |
357 | from nested functions. */ | |
358 | unsigned int has_nonlocal_label : 1; | |
359 | ||
aa43616c RH |
360 | /* Nonzero if function being compiled has a forced label |
361 | placed into static storage. */ | |
362 | unsigned int has_forced_label_in_static : 1; | |
363 | ||
b8698a0f | 364 | /* Nonzero if we've set cannot_be_copied_reason. I.e. if |
27dbd3ac RH |
365 | (cannot_be_copied_set && !cannot_be_copied_reason), the function |
366 | can in fact be copied. */ | |
367 | unsigned int cannot_be_copied_set : 1; | |
368 | ||
6c535c69 | 369 | /* Nonzero if current function uses stdarg.h or equivalent. */ |
89996b6e RH |
370 | unsigned int stdarg : 1; |
371 | ||
55dea919 | 372 | unsigned int after_inlining : 1; |
0889e9bc | 373 | unsigned int always_inline_functions_inlined : 1; |
55dea919 | 374 | |
8f4f502f EB |
375 | /* Nonzero if function being compiled can throw synchronous non-call |
376 | exceptions. */ | |
377 | unsigned int can_throw_non_call_exceptions : 1; | |
378 | ||
2da02156 EB |
379 | /* Nonzero if instructions that may throw exceptions but don't otherwise |
380 | contribute to the execution of the program can be deleted. */ | |
381 | unsigned int can_delete_dead_exceptions : 1; | |
382 | ||
182e0d71 AK |
383 | /* Fields below this point are not set for abstract functions; see |
384 | allocate_struct_function. */ | |
385 | ||
386 | /* Nonzero if function being compiled needs to be given an address | |
387 | where the value should be stored. */ | |
388 | unsigned int returns_struct : 1; | |
389 | ||
390 | /* Nonzero if function being compiled needs to | |
391 | return the address of where it has put a structure value. */ | |
392 | unsigned int returns_pcc_struct : 1; | |
135a171d | 393 | |
fc3103e7 JJ |
394 | /* Nonzero if this function has local DECL_HARD_REGISTER variables. |
395 | In this case code motion has to be done more carefully. */ | |
396 | unsigned int has_local_explicit_reg_vars : 1; | |
3c072c6b JY |
397 | |
398 | /* Nonzero if the current function is a thunk, i.e., a lightweight | |
399 | function implemented by the output_mi_thunk hook) that just | |
400 | adjusts one of its arguments and forwards to another | |
401 | function. */ | |
402 | unsigned int is_thunk : 1; | |
74bf76ed JJ |
403 | |
404 | /* Nonzero if the current function contains any loops with | |
b15b5979 EB |
405 | loop->force_vectorize set. */ |
406 | unsigned int has_force_vectorize_loops : 1; | |
74bf76ed JJ |
407 | |
408 | /* Nonzero if the current function contains any loops with | |
409 | nonzero value in loop->simduid. */ | |
410 | unsigned int has_simduid_loops : 1; | |
e2f0f5f7 | 411 | |
ac9effed | 412 | /* Nonzero when the tail call has been identified. */ |
e2f0f5f7 | 413 | unsigned int tail_call_marked : 1; |
ac9effed EB |
414 | |
415 | /* Nonzero if the current function contains a #pragma GCC unroll. */ | |
416 | unsigned int has_unroll : 1; | |
96a95ac1 AO |
417 | |
418 | /* Set when the function was compiled with generation of debug | |
419 | (begin stmt, inline entry, ...) markers enabled. */ | |
420 | unsigned int debug_nonbind_markers : 1; | |
49789fd0 IS |
421 | |
422 | /* Set if this is a coroutine-related function. */ | |
423 | unsigned int coroutine_component : 1; | |
49ddde69 JJ |
424 | |
425 | /* Set if there are any OMP_TARGET regions in the function. */ | |
426 | unsigned int has_omp_target : 1; | |
bf6beae5 CH |
427 | }; |
428 | ||
c021f10b NF |
429 | /* Add the decl D to the local_decls list of FUN. */ |
430 | ||
5cf18d25 | 431 | void add_local_decl (struct function *fun, tree d); |
c021f10b NF |
432 | |
433 | #define FOR_EACH_LOCAL_DECL(FUN, I, D) \ | |
9771b263 | 434 | FOR_EACH_VEC_SAFE_ELT_REVERSE ((FUN)->local_decls, I, D) |
c021f10b | 435 | |
3cf3da88 EB |
436 | /* Record a final call to CALLEE at LOCATION. */ |
437 | void record_final_call (tree callee, location_t location); | |
438 | ||
439 | /* Record a dynamic allocation made for DECL_OR_EXP. */ | |
440 | void record_dynamic_alloc (tree decl_or_exp); | |
441 | ||
9d30f3c1 JJ |
442 | /* If va_list_[gf]pr_size is set to this, it means we don't know how |
443 | many units need to be saved. */ | |
444 | #define VA_LIST_MAX_GPR_SIZE 255 | |
445 | #define VA_LIST_MAX_FPR_SIZE 255 | |
446 | ||
01d939e8 | 447 | /* The function currently being compiled. */ |
e2500fed | 448 | extern GTY(()) struct function *cfun; |
01d939e8 | 449 | |
5576d6f2 TT |
450 | /* In order to ensure that cfun is not set directly, we redefine it so |
451 | that it is not an lvalue. Rather than assign to cfun, use | |
452 | push_cfun or set_cfun. */ | |
453 | #define cfun (cfun + 0) | |
454 | ||
c39ada04 DD |
455 | /* Nonzero if we've already converted virtual regs to hard regs. */ |
456 | extern int virtuals_instantiated; | |
457 | ||
3edc56a9 JJ |
458 | /* Nonzero if at least one trampoline has been created. */ |
459 | extern int trampolines_created; | |
460 | ||
2a22f99c | 461 | struct GTY((for_user)) types_used_by_vars_entry { |
b646ba3f DS |
462 | tree type; |
463 | tree var_decl; | |
464 | }; | |
465 | ||
ca752f39 | 466 | struct used_type_hasher : ggc_ptr_hash<types_used_by_vars_entry> |
2a22f99c TS |
467 | { |
468 | static hashval_t hash (types_used_by_vars_entry *); | |
469 | static bool equal (types_used_by_vars_entry *, types_used_by_vars_entry *); | |
470 | }; | |
471 | ||
b646ba3f DS |
472 | /* Hash table making the relationship between a global variable |
473 | and the types it references in its initializer. The key of the | |
474 | entry is a referenced type, and the value is the DECL of the global | |
475 | variable. types_use_by_vars_do_hash and types_used_by_vars_eq below are | |
476 | the hash and equality functions to use for this hash table. */ | |
2a22f99c | 477 | extern GTY(()) hash_table<used_type_hasher> *types_used_by_vars_hash; |
b646ba3f | 478 | |
b646ba3f DS |
479 | void types_used_by_var_decl_insert (tree type, tree var_decl); |
480 | ||
bc87224e NF |
481 | /* During parsing of a global variable, this vector contains the types |
482 | referenced by the global variable. */ | |
9771b263 | 483 | extern GTY(()) vec<tree, va_gc> *types_used_by_cur_var_decl; |
b646ba3f | 484 | |
db2960f4 | 485 | |
0fc822d0 RB |
486 | /* Return the loop tree of FN. */ |
487 | ||
488 | inline struct loops * | |
489 | loops_for_fn (struct function *fn) | |
490 | { | |
491 | return fn->x_current_loops; | |
492 | } | |
493 | ||
494 | /* Set the loop tree of FN to LOOPS. */ | |
495 | ||
496 | inline void | |
497 | set_loops_for_fn (struct function *fn, struct loops *loops) | |
498 | { | |
499 | gcc_checking_assert (fn->x_current_loops == NULL || loops == NULL); | |
500 | fn->x_current_loops = loops; | |
501 | } | |
502 | ||
49ad7cfa | 503 | /* For backward compatibility... eventually these should all go away. */ |
df696a75 | 504 | #define current_function_funcdef_no (cfun->funcdef_no) |
01d939e8 | 505 | |
598ec7bd | 506 | #define current_loops (cfun->x_current_loops) |
8fee41c2 ZD |
507 | #define dom_computed (cfun->cfg->x_dom_computed) |
508 | #define n_bbs_in_dom_tree (cfun->cfg->x_n_bbs_in_dom_tree) | |
6946b3f7 | 509 | #define VALUE_HISTOGRAMS(fun) (fun)->value_histograms |
bf6beae5 | 510 | |
83685514 AM |
511 | /* A pointer to a function to create target specific, per-function |
512 | data structures. */ | |
513 | extern struct machine_function * (*init_machine_status) (void); | |
d6e1b011 | 514 | |
83685514 AM |
515 | /* Structure to record the size of a sequence of arguments |
516 | as the sum of a tree-expression and a constant. This structure is | |
517 | also used to store offsets from the stack, which might be negative, | |
518 | so the variable part must be ssizetype, not sizetype. */ | |
519 | ||
520 | struct args_size | |
521 | { | |
a20c5714 | 522 | poly_int64_pod constant; |
83685514 AM |
523 | tree var; |
524 | }; | |
525 | ||
526 | /* Package up various arg related fields of struct args for | |
527 | locate_and_pad_parm. */ | |
528 | struct locate_and_pad_arg_data | |
529 | { | |
530 | /* Size of this argument on the stack, rounded up for any padding it | |
531 | gets. If REG_PARM_STACK_SPACE is defined, then register parms are | |
532 | counted here, otherwise they aren't. */ | |
533 | struct args_size size; | |
534 | /* Offset of this argument from beginning of stack-args. */ | |
535 | struct args_size offset; | |
536 | /* Offset to the start of the stack slot. Different from OFFSET | |
537 | if this arg pads downward. */ | |
538 | struct args_size slot_offset; | |
539 | /* The amount that the stack pointer needs to be adjusted to | |
540 | force alignment for the next argument. */ | |
541 | struct args_size alignment_pad; | |
542 | /* Which way we should pad this arg. */ | |
76b0cbf8 | 543 | pad_direction where_pad; |
83685514 AM |
544 | /* slot_offset is at least this aligned. */ |
545 | unsigned int boundary; | |
546 | }; | |
547 | ||
548 | /* Add the value of the tree INC to the `struct args_size' TO. */ | |
549 | ||
550 | #define ADD_PARM_SIZE(TO, INC) \ | |
551 | do { \ | |
552 | tree inc = (INC); \ | |
553 | if (tree_fits_shwi_p (inc)) \ | |
554 | (TO).constant += tree_to_shwi (inc); \ | |
555 | else if ((TO).var == 0) \ | |
556 | (TO).var = fold_convert (ssizetype, inc); \ | |
557 | else \ | |
558 | (TO).var = size_binop (PLUS_EXPR, (TO).var, \ | |
559 | fold_convert (ssizetype, inc)); \ | |
560 | } while (0) | |
561 | ||
562 | #define SUB_PARM_SIZE(TO, DEC) \ | |
563 | do { \ | |
564 | tree dec = (DEC); \ | |
565 | if (tree_fits_shwi_p (dec)) \ | |
566 | (TO).constant -= tree_to_shwi (dec); \ | |
567 | else if ((TO).var == 0) \ | |
568 | (TO).var = size_binop (MINUS_EXPR, ssize_int (0), \ | |
569 | fold_convert (ssizetype, dec)); \ | |
570 | else \ | |
571 | (TO).var = size_binop (MINUS_EXPR, (TO).var, \ | |
572 | fold_convert (ssizetype, dec)); \ | |
573 | } while (0) | |
574 | ||
575 | /* Convert the implicit sum in a `struct args_size' into a tree | |
576 | of type ssizetype. */ | |
577 | #define ARGS_SIZE_TREE(SIZE) \ | |
578 | ((SIZE).var == 0 ? ssize_int ((SIZE).constant) \ | |
579 | : size_binop (PLUS_EXPR, fold_convert (ssizetype, (SIZE).var), \ | |
580 | ssize_int ((SIZE).constant))) | |
581 | ||
582 | /* Convert the implicit sum in a `struct args_size' into an rtx. */ | |
583 | #define ARGS_SIZE_RTX(SIZE) \ | |
a20c5714 | 584 | ((SIZE).var == 0 ? gen_int_mode ((SIZE).constant, Pmode) \ |
83685514 AM |
585 | : expand_normal (ARGS_SIZE_TREE (SIZE))) |
586 | ||
587 | #define ASLK_REDUCE_ALIGN 1 | |
588 | #define ASLK_RECORD_PAD 2 | |
589 | ||
c1fffdf1 CB |
590 | /* If pointers to member functions use the least significant bit to |
591 | indicate whether a function is virtual, ensure a pointer | |
592 | to this function will have that bit clear. */ | |
593 | #define MINIMUM_METHOD_BOUNDARY \ | |
594 | ((TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_pfn) \ | |
595 | ? MAX (FUNCTION_BOUNDARY, 2 * BITS_PER_UNIT) : FUNCTION_BOUNDARY) | |
596 | ||
8a502a80 JL |
597 | enum stack_clash_probes { |
598 | NO_PROBE_NO_FRAME, | |
599 | NO_PROBE_SMALL_FRAME, | |
600 | PROBE_INLINE, | |
601 | PROBE_LOOP | |
602 | }; | |
603 | ||
604 | extern void dump_stack_clash_frame_info (enum stack_clash_probes, bool); | |
83685514 AM |
605 | \f |
606 | ||
607 | extern void push_function_context (void); | |
608 | extern void pop_function_context (void); | |
609 | ||
610 | /* Save and restore status information for a nested function. */ | |
611 | extern void free_after_parsing (struct function *); | |
612 | extern void free_after_compilation (struct function *); | |
6de9cd9a | 613 | |
9a807d3a RK |
614 | /* Return size needed for stack frame based on slots so far allocated. |
615 | This size counts from zero. It is not rounded to STACK_BOUNDARY; | |
616 | the caller may have to do that. */ | |
f075bd95 | 617 | extern poly_int64 get_frame_size (void); |
9a807d3a | 618 | |
9fb798d7 EB |
619 | /* Issue an error message and return TRUE if frame OFFSET overflows in |
620 | the signed target pointer arithmetics for function FUNC. Otherwise | |
621 | return FALSE. */ | |
f075bd95 | 622 | extern bool frame_offset_overflow (poly_int64, tree); |
9fb798d7 | 623 | |
83d0488b RS |
624 | extern unsigned int spill_slot_alignment (machine_mode); |
625 | ||
f075bd95 RS |
626 | extern rtx assign_stack_local_1 (machine_mode, poly_int64, int, int); |
627 | extern rtx assign_stack_local (machine_mode, poly_int64, int); | |
628 | extern rtx assign_stack_temp_for_type (machine_mode, poly_int64, tree); | |
629 | extern rtx assign_stack_temp (machine_mode, poly_int64); | |
83685514 AM |
630 | extern rtx assign_temp (tree, int, int); |
631 | extern void update_temp_slot_address (rtx, rtx); | |
632 | extern void preserve_temp_slots (rtx); | |
633 | extern void free_temp_slots (void); | |
634 | extern void push_temp_slots (void); | |
635 | extern void pop_temp_slots (void); | |
636 | extern void init_temp_slots (void); | |
637 | extern rtx get_hard_reg_initial_reg (rtx); | |
ef4bddc2 RS |
638 | extern rtx get_hard_reg_initial_val (machine_mode, unsigned int); |
639 | extern rtx has_hard_reg_initial_val (machine_mode, unsigned int); | |
ba534a45 | 640 | |
83685514 AM |
641 | /* Called from gimple_expand_cfg. */ |
642 | extern unsigned int emit_initial_value_sets (void); | |
643 | ||
644 | extern bool initial_value_entry (int i, rtx *, rtx *); | |
645 | extern void instantiate_decl_rtl (rtx x); | |
646 | extern int aggregate_value_p (const_tree, const_tree); | |
647 | extern bool use_register_for_decl (const_tree); | |
6aee2fd0 | 648 | extern gimple_seq gimplify_parameters (gimple_seq *); |
ef4bddc2 | 649 | extern void locate_and_pad_parm (machine_mode, tree, int, int, int, |
83685514 AM |
650 | tree, struct args_size *, |
651 | struct locate_and_pad_arg_data *); | |
652 | extern void generate_setjmp_warnings (void); | |
653 | ||
654 | /* Identify BLOCKs referenced by more than one NOTE_INSN_BLOCK_{BEG,END}, | |
655 | and create duplicate blocks. */ | |
656 | extern void reorder_blocks (void); | |
657 | extern void clear_block_marks (tree); | |
658 | extern tree blocks_nreverse (tree); | |
659 | extern tree block_chainon (tree, tree); | |
a00b8dfa | 660 | |
83685514 AM |
661 | /* Set BLOCK_NUMBER for all the blocks in FN. */ |
662 | extern void number_blocks (tree); | |
663 | ||
664 | /* cfun shouldn't be set directly; use one of these functions instead. */ | |
77719b06 | 665 | extern void set_cfun (struct function *new_cfun, bool force = false); |
83685514 AM |
666 | extern void push_cfun (struct function *new_cfun); |
667 | extern void pop_cfun (void); | |
668 | ||
669 | extern int get_next_funcdef_no (void); | |
670 | extern int get_last_funcdef_no (void); | |
671 | extern void allocate_struct_function (tree, bool); | |
672 | extern void push_struct_function (tree fndecl); | |
5283d1ec TV |
673 | extern void push_dummy_function (bool); |
674 | extern void pop_dummy_function (void); | |
83685514 AM |
675 | extern void init_dummy_function_start (void); |
676 | extern void init_function_start (tree); | |
677 | extern void stack_protect_epilogue (void); | |
678 | extern void expand_function_start (tree); | |
679 | extern void expand_dummy_function_end (void); | |
fa51b01b | 680 | |
c81b4a0e | 681 | extern void thread_prologue_and_epilogue_insns (void); |
fa8db1f7 AJ |
682 | extern void diddle_return_value (void (*)(rtx, void*), void*); |
683 | extern void clobber_return_register (void); | |
83685514 | 684 | extern void expand_function_end (void); |
bd60bab2 | 685 | extern rtx get_arg_pointer_save_area (void); |
83685514 | 686 | extern void maybe_copy_prologue_epilogue_insn (rtx, rtx); |
87ac59a0 TS |
687 | extern int prologue_contains (const rtx_insn *); |
688 | extern int epilogue_contains (const rtx_insn *); | |
689 | extern int prologue_epilogue_contains (const rtx_insn *); | |
64f6e1e1 SB |
690 | extern void record_prologue_seq (rtx_insn *); |
691 | extern void record_epilogue_seq (rtx_insn *); | |
83685514 | 692 | extern void emit_return_into_block (bool simple_p, basic_block bb); |
d38ff8dd | 693 | extern void set_return_jump_label (rtx_insn *); |
83685514 AM |
694 | extern bool active_insn_between (rtx_insn *head, rtx_insn *tail); |
695 | extern vec<edge> convert_jumps_to_returns (basic_block last_bb, bool simple_p, | |
696 | vec<edge> unconverted); | |
697 | extern basic_block emit_return_for_exit (edge exit_fallthru_edge, | |
698 | bool simple_p); | |
699 | extern void reposition_prologue_and_epilogue_notes (void); | |
278ed218 | 700 | |
faed5cc3 | 701 | /* Returns the name of the current function. */ |
df92c640 | 702 | extern const char *fndecl_name (tree); |
532aafad | 703 | extern const char *function_name (struct function *); |
faed5cc3 SB |
704 | extern const char *current_function_name (void); |
705 | ||
8d8d1a28 | 706 | extern void used_types_insert (tree); |
33c9159e | 707 | |
264fa2db | 708 | #endif /* GCC_FUNCTION_H */ |