1 | /* Structure for saving state for a nested function. |
2 | Copyright (C) 1989-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_FUNCTION_H |
21 | #define GCC_FUNCTION_H |
22 | |
23 | |
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 | |
29 | struct GTY(()) sequence_stack { |
30 | /* First and last insns in the chain of the saved sequence. */ |
31 | rtx_insn *first; |
32 | rtx_insn *last; |
33 | struct sequence_stack *next; |
34 | }; |
35 | |
36 | struct GTY(()) emit_status { |
37 | void ensure_regno_capacity (); |
38 | |
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 | |
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. |
49 | |
50 | start_sequence saves both of these on seq.next and then starts |
51 | a new, nested sequence of insns. |
52 | |
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; |
57 | |
58 | /* INSN_UID for next insn emitted. |
59 | Reset to 1 for each function compiled. */ |
60 | int x_cur_insn_uid; |
61 | |
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 | |
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. */ |
70 | int regno_pointer_align_length; |
71 | |
72 | /* Indexed by pseudo register number, if nonzero gives the known alignment |
73 | for that pseudo (if REG_POINTER is set in x_regno_reg_rtx). |
74 | Allocated in parallel with x_regno_reg_rtx. */ |
75 | unsigned char * GTY((skip)) regno_pointer_align; |
76 | }; |
77 | |
78 | |
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. */ |
86 | |
87 | extern GTY ((length ("crtl->emit.x_reg_rtx_no" ))) rtx * regno_reg_rtx; |
88 | |
89 | /* For backward compatibility... eventually these should all go away. */ |
90 | #define reg_rtx_no (crtl->emit.x_reg_rtx_no) |
91 | |
92 | #define REGNO_POINTER_ALIGN(REGNO) (crtl->emit.regno_pointer_align[REGNO]) |
93 | |
94 | struct GTY(()) expr_status { |
95 | /* Number of units that we should eventually pop off the stack. |
96 | These are the arguments to function calls that have already returned. */ |
97 | poly_int64 x_pending_stack_adjust; |
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 | |
110 | When INHIBIT_DEFER_POP is nonzero, however, the compiler does not |
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 | |
116 | /* If PREFERRED_STACK_BOUNDARY and PUSH_ROUNDING are defined, the stack |
117 | boundary can be momentarily unaligned while pushing the arguments. |
118 | Record the delta since last aligned boundary here in order to get |
119 | stack alignment in the nested function calls working right. */ |
120 | poly_int64 x_stack_pointer_delta; |
121 | |
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. */ |
131 | vec<rtx_insn *, va_gc> *x_forced_labels; |
132 | }; |
133 | |
134 | typedef struct call_site_record_d *call_site_record; |
135 | |
136 | /* RTL representation of exception handling. */ |
137 | struct GTY(()) rtl_eh { |
138 | rtx ehr_stackadj; |
139 | rtx ehr_handler; |
140 | rtx_code_label *ehr_label; |
141 | |
142 | rtx sjlj_fc; |
143 | rtx_insn *sjlj_exit_after; |
144 | |
145 | vec<uchar, va_gc> *action_record_data; |
146 | |
147 | vec<call_site_record, va_gc> *call_site_record_v[2]; |
148 | }; |
149 | |
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) |
156 | |
157 | struct gimple_df; |
158 | struct call_site_record_d; |
159 | struct dw_fde_node; |
160 | class range_query; |
161 | |
162 | struct GTY(()) varasm_status { |
163 | /* If we're using a per-function constant pool, this is it. */ |
164 | struct rtx_constant_pool *pool; |
165 | |
166 | /* Number of tree-constants deferred during the expansion of this |
167 | function. */ |
168 | unsigned int deferred_constants; |
169 | }; |
170 | |
171 | |
172 | /* Data for function partitioning. */ |
173 | struct GTY(()) function_subsections { |
174 | /* Assembly labels for the hot and cold text sections, to |
175 | be used by debugger functions for determining the size of text |
176 | sections. */ |
177 | |
178 | const char *hot_section_label; |
179 | const char *cold_section_label; |
180 | const char *hot_section_end_label; |
181 | const char *cold_section_end_label; |
182 | }; |
183 | |
184 | /* Describe an empty area of space in the stack frame. These can be chained |
185 | into a list; this is used to keep track of space wasted for alignment |
186 | reasons. */ |
187 | class GTY(()) frame_space |
188 | { |
189 | public: |
190 | class frame_space *next; |
191 | |
192 | poly_int64 start; |
193 | poly_int64 length; |
194 | }; |
195 | |
196 | /* Describe emitted calls for -fcallgraph-info. */ |
197 | struct GTY(()) callinfo_callee |
198 | { |
199 | location_t location; |
200 | tree decl; |
201 | }; |
202 | |
203 | /* Describe dynamic allocation for -fcallgraph-info=da. */ |
204 | struct GTY(()) callinfo_dalloc |
205 | { |
206 | location_t location; |
207 | char const *name; |
208 | }; |
209 | |
210 | class GTY(()) stack_usage |
211 | { |
212 | public: |
213 | /* # of bytes of static stack space allocated by the function. */ |
214 | HOST_WIDE_INT static_stack_size; |
215 | |
216 | /* # of bytes of dynamic stack space allocated by the function. This is |
217 | meaningful only if has_unbounded_dynamic_stack_size is zero. */ |
218 | HOST_WIDE_INT dynamic_stack_size; |
219 | |
220 | /* Upper bound on the number of bytes pushed onto the stack after the |
221 | prologue. If !ACCUMULATE_OUTGOING_ARGS, it contains the outgoing |
222 | arguments. */ |
223 | poly_int64 pushed_stack_size; |
224 | |
225 | /* Nonzero if the amount of stack space allocated dynamically cannot |
226 | be bounded at compile-time. */ |
227 | unsigned int has_unbounded_dynamic_stack_size : 1; |
228 | |
229 | /* Functions called within the function, if callgraph is enabled. */ |
230 | vec<callinfo_callee, va_gc> *callees; |
231 | |
232 | /* Dynamic allocations encountered within the function, if callgraph |
233 | da is enabled. */ |
234 | vec<callinfo_dalloc, va_gc> *dallocs; |
235 | }; |
236 | |
237 | #define current_function_static_stack_size (cfun->su->static_stack_size) |
238 | #define current_function_dynamic_stack_size (cfun->su->dynamic_stack_size) |
239 | #define current_function_pushed_stack_size (cfun->su->pushed_stack_size) |
240 | #define current_function_has_unbounded_dynamic_stack_size \ |
241 | (cfun->su->has_unbounded_dynamic_stack_size) |
242 | #define current_function_allocates_dynamic_stack_space \ |
243 | (current_function_dynamic_stack_size != 0 \ |
244 | || current_function_has_unbounded_dynamic_stack_size) |
245 | |
246 | /* This structure can save all the important global and static variables |
247 | describing the status of the current function. */ |
248 | |
249 | struct GTY(()) function { |
250 | struct eh_status *eh; |
251 | |
252 | /* The control flow graph for this function. */ |
253 | struct control_flow_graph *cfg; |
254 | |
255 | /* GIMPLE body for this function. */ |
256 | gimple_seq gimple_body; |
257 | |
258 | /* SSA and dataflow information. */ |
259 | struct gimple_df *gimple_df; |
260 | |
261 | /* The loops in this function. */ |
262 | struct loops *x_current_loops; |
263 | |
264 | /* Filled by the GIMPLE and RTL FEs, pass to start compilation with. */ |
265 | char *pass_startwith; |
266 | |
267 | /* The stack usage of this function. */ |
268 | class stack_usage *su; |
269 | |
270 | /* Value histograms attached to particular statements. */ |
271 | htab_t GTY((skip)) value_histograms; |
272 | |
273 | /* For function.cc. */ |
274 | |
275 | /* Points to the FUNCTION_DECL of this function. */ |
276 | tree decl; |
277 | |
278 | /* A PARM_DECL that should contain the static chain for this function. |
279 | It will be initialized at the beginning of the function. */ |
280 | tree static_chain_decl; |
281 | |
282 | /* An expression that contains the non-local goto save area. The first |
283 | word is the saved frame pointer and the second is the saved stack |
284 | pointer. */ |
285 | tree nonlocal_goto_save_area; |
286 | |
287 | /* Vector of function local variables, functions, types and constants. */ |
288 | vec<tree, va_gc> *local_decls; |
289 | |
290 | /* For md files. */ |
291 | |
292 | /* tm.h can use this to store whatever it likes. */ |
293 | struct machine_function * GTY ((maybe_undef)) machine; |
294 | |
295 | /* Language-specific code can use this to store whatever it likes. */ |
296 | struct language_function * language; |
297 | |
298 | /* Used types hash table. */ |
299 | hash_set<tree> *GTY (()) used_types_hash; |
300 | |
301 | /* Dwarf2 Frame Description Entry, containing the Call Frame Instructions |
302 | used for unwinding. Only set when either dwarf2 unwinding or dwarf2 |
303 | debugging is enabled. */ |
304 | struct dw_fde_node *fde; |
305 | |
306 | /* Range query mechanism for functions. The default is to pick up |
307 | global ranges. If a pass wants on-demand ranges OTOH, it must |
308 | call enable/disable_ranger(). The pointer is never null. It |
309 | should be queried by calling get_range_query(). */ |
310 | range_query * GTY ((skip)) x_range_query; |
311 | |
312 | /* Last statement uid. */ |
313 | int last_stmt_uid; |
314 | |
315 | /* Debug marker counter. Count begin stmt markers. We don't have |
316 | to keep it exact, it's more of a rough estimate to enable us to |
317 | decide whether they are too many to copy during inlining, or when |
318 | expanding to RTL. */ |
319 | int debug_marker_count; |
320 | |
321 | /* Function sequence number for profiling, debugging, etc. */ |
322 | int funcdef_no; |
323 | |
324 | /* Line number of the start of the function for debugging purposes. */ |
325 | location_t function_start_locus; |
326 | |
327 | /* Line number of the end of the function. */ |
328 | location_t function_end_locus; |
329 | |
330 | /* Properties used by the pass manager. */ |
331 | unsigned int curr_properties; |
332 | unsigned int last_verified; |
333 | |
334 | /* Different from normal TODO_flags which are handled right at the |
335 | beginning or the end of one pass execution, the pending_TODOs |
336 | are passed down in the pipeline until one of its consumers can |
337 | perform the requested action. Consumers should then clear the |
338 | flags for the actions that they have taken. */ |
339 | unsigned int pending_TODOs; |
340 | |
341 | /* Non-null if the function does something that would prevent it from |
342 | being copied; this applies to both versioning and inlining. Set to |
343 | a string describing the reason for failure. */ |
344 | const char * GTY((skip)) cannot_be_copied_reason; |
345 | |
346 | /* Last assigned dependence info clique. */ |
347 | unsigned short last_clique; |
348 | |
349 | /* Collected bit flags. */ |
350 | |
351 | /* Number of units of general registers that need saving in stdarg |
352 | function. What unit is depends on the backend, either it is number |
353 | of bytes, or it can be number of registers. */ |
354 | unsigned int va_list_gpr_size : 8; |
355 | |
356 | /* Number of units of floating point registers that need saving in stdarg |
357 | function. */ |
358 | unsigned int va_list_fpr_size : 8; |
359 | |
360 | /* Nonzero if function being compiled can call setjmp. */ |
361 | unsigned int calls_setjmp : 1; |
362 | |
363 | /* Nonzero if function being compiled can call alloca, |
364 | either as a subroutine or builtin. */ |
365 | unsigned int calls_alloca : 1; |
366 | |
367 | /* Nonzero if function being compiled can call __builtin_eh_return. */ |
368 | unsigned int calls_eh_return : 1; |
369 | |
370 | /* Nonzero if function being compiled receives nonlocal gotos |
371 | from nested functions. */ |
372 | unsigned int has_nonlocal_label : 1; |
373 | |
374 | /* Nonzero if function being compiled has a forced label |
375 | placed into static storage. */ |
376 | unsigned int has_forced_label_in_static : 1; |
377 | |
378 | /* Nonzero if we've set cannot_be_copied_reason. I.e. if |
379 | (cannot_be_copied_set && !cannot_be_copied_reason), the function |
380 | can in fact be copied. */ |
381 | unsigned int cannot_be_copied_set : 1; |
382 | |
383 | /* Nonzero if current function uses stdarg.h or equivalent. */ |
384 | unsigned int stdarg : 1; |
385 | |
386 | unsigned int after_inlining : 1; |
387 | unsigned int always_inline_functions_inlined : 1; |
388 | |
389 | /* Nonzero if function being compiled can throw synchronous non-call |
390 | exceptions. */ |
391 | unsigned int can_throw_non_call_exceptions : 1; |
392 | |
393 | /* Nonzero if instructions that may throw exceptions but don't otherwise |
394 | contribute to the execution of the program can be deleted. */ |
395 | unsigned int can_delete_dead_exceptions : 1; |
396 | |
397 | /* Fields below this point are not set for abstract functions; see |
398 | allocate_struct_function. */ |
399 | |
400 | /* Nonzero if function being compiled needs to be given an address |
401 | where the value should be stored. */ |
402 | unsigned int returns_struct : 1; |
403 | |
404 | /* Nonzero if function being compiled needs to |
405 | return the address of where it has put a structure value. */ |
406 | unsigned int returns_pcc_struct : 1; |
407 | |
408 | /* Nonzero if this function has local DECL_HARD_REGISTER variables. |
409 | In this case code motion has to be done more carefully. */ |
410 | unsigned int has_local_explicit_reg_vars : 1; |
411 | |
412 | /* Nonzero if the current function is a thunk, i.e., a lightweight |
413 | function implemented by the output_mi_thunk hook) that just |
414 | adjusts one of its arguments and forwards to another |
415 | function. */ |
416 | unsigned int is_thunk : 1; |
417 | |
418 | /* Nonzero if the current function contains any loops with |
419 | loop->force_vectorize set. */ |
420 | unsigned int has_force_vectorize_loops : 1; |
421 | |
422 | /* Nonzero if the current function contains any loops with |
423 | nonzero value in loop->simduid. */ |
424 | unsigned int has_simduid_loops : 1; |
425 | |
426 | /* Nonzero when the tail call has been identified. */ |
427 | unsigned int tail_call_marked : 1; |
428 | |
429 | /* Nonzero if the current function contains a #pragma GCC unroll. */ |
430 | unsigned int has_unroll : 1; |
431 | |
432 | /* Set when the function was compiled with generation of debug |
433 | (begin stmt, inline entry, ...) markers enabled. */ |
434 | unsigned int debug_nonbind_markers : 1; |
435 | |
436 | /* Set if this is a coroutine-related function. */ |
437 | unsigned int coroutine_component : 1; |
438 | |
439 | /* Set if there are any OMP_TARGET regions in the function. */ |
440 | unsigned int has_omp_target : 1; |
441 | |
442 | /* Set for artificial function created for [[assume (cond)]]. |
443 | These should be GIMPLE optimized, but not expanded to RTL. */ |
444 | unsigned int assume_function : 1; |
445 | }; |
446 | |
447 | /* Add the decl D to the local_decls list of FUN. */ |
448 | |
449 | void add_local_decl (struct function *fun, tree d); |
450 | |
451 | #define FOR_EACH_LOCAL_DECL(FUN, I, D) \ |
452 | FOR_EACH_VEC_SAFE_ELT_REVERSE ((FUN)->local_decls, I, D) |
453 | |
454 | /* Record a final call to CALLEE at LOCATION. */ |
455 | void record_final_call (tree callee, location_t location); |
456 | |
457 | /* Record a dynamic allocation made for DECL_OR_EXP. */ |
458 | void record_dynamic_alloc (tree decl_or_exp); |
459 | |
460 | /* If va_list_[gf]pr_size is set to this, it means we don't know how |
461 | many units need to be saved. */ |
462 | #define VA_LIST_MAX_GPR_SIZE 255 |
463 | #define VA_LIST_MAX_FPR_SIZE 255 |
464 | |
465 | /* The function currently being compiled. */ |
466 | extern GTY(()) struct function *cfun; |
467 | |
468 | /* In order to ensure that cfun is not set directly, we redefine it so |
469 | that it is not an lvalue. Rather than assign to cfun, use |
470 | push_cfun or set_cfun. */ |
471 | #define cfun (cfun + 0) |
472 | |
473 | /* Nonzero if we've already converted virtual regs to hard regs. */ |
474 | extern int virtuals_instantiated; |
475 | |
476 | /* Nonzero if at least one trampoline has been created. */ |
477 | extern int trampolines_created; |
478 | |
479 | struct GTY((for_user)) types_used_by_vars_entry { |
480 | tree type; |
481 | tree var_decl; |
482 | }; |
483 | |
484 | struct used_type_hasher : ggc_ptr_hash<types_used_by_vars_entry> |
485 | { |
486 | static hashval_t hash (types_used_by_vars_entry *); |
487 | static bool equal (types_used_by_vars_entry *, types_used_by_vars_entry *); |
488 | }; |
489 | |
490 | /* Hash table making the relationship between a global variable |
491 | and the types it references in its initializer. The key of the |
492 | entry is a referenced type, and the value is the DECL of the global |
493 | variable. types_use_by_vars_do_hash and types_used_by_vars_eq below are |
494 | the hash and equality functions to use for this hash table. */ |
495 | extern GTY(()) hash_table<used_type_hasher> *types_used_by_vars_hash; |
496 | |
497 | void types_used_by_var_decl_insert (tree type, tree var_decl); |
498 | |
499 | /* During parsing of a global variable, this vector contains the types |
500 | referenced by the global variable. */ |
501 | extern GTY(()) vec<tree, va_gc> *types_used_by_cur_var_decl; |
502 | |
503 | |
504 | /* Return the loop tree of FN. */ |
505 | |
506 | inline struct loops * |
507 | loops_for_fn (struct function *fn) |
508 | { |
509 | return fn->x_current_loops; |
510 | } |
511 | |
512 | /* Set the loop tree of FN to LOOPS. */ |
513 | |
514 | inline void |
515 | set_loops_for_fn (struct function *fn, struct loops *loops) |
516 | { |
517 | gcc_checking_assert (fn->x_current_loops == NULL || loops == NULL); |
518 | fn->x_current_loops = loops; |
519 | } |
520 | |
521 | /* For backward compatibility... eventually these should all go away. */ |
522 | #define current_function_funcdef_no (cfun->funcdef_no) |
523 | |
524 | #define current_loops (cfun->x_current_loops) |
525 | #define dom_computed (cfun->cfg->x_dom_computed) |
526 | #define n_bbs_in_dom_tree (cfun->cfg->x_n_bbs_in_dom_tree) |
527 | #define VALUE_HISTOGRAMS(fun) (fun)->value_histograms |
528 | |
529 | /* A pointer to a function to create target specific, per-function |
530 | data structures. */ |
531 | extern struct machine_function * (*init_machine_status) (void); |
532 | |
533 | /* Structure to record the size of a sequence of arguments |
534 | as the sum of a tree-expression and a constant. This structure is |
535 | also used to store offsets from the stack, which might be negative, |
536 | so the variable part must be ssizetype, not sizetype. */ |
537 | |
538 | struct args_size |
539 | { |
540 | poly_int64 constant; |
541 | tree var; |
542 | }; |
543 | |
544 | /* Package up various arg related fields of struct args for |
545 | locate_and_pad_parm. */ |
546 | struct locate_and_pad_arg_data |
547 | { |
548 | /* Size of this argument on the stack, rounded up for any padding it |
549 | gets. If REG_PARM_STACK_SPACE is defined, then register parms are |
550 | counted here, otherwise they aren't. */ |
551 | struct args_size size; |
552 | /* Offset of this argument from beginning of stack-args. */ |
553 | struct args_size offset; |
554 | /* Offset to the start of the stack slot. Different from OFFSET |
555 | if this arg pads downward. */ |
556 | struct args_size slot_offset; |
557 | /* The amount that the stack pointer needs to be adjusted to |
558 | force alignment for the next argument. */ |
559 | struct args_size alignment_pad; |
560 | /* Which way we should pad this arg. */ |
561 | pad_direction where_pad; |
562 | /* slot_offset is at least this aligned. */ |
563 | unsigned int boundary; |
564 | }; |
565 | |
566 | /* Add the value of the tree INC to the `struct args_size' TO. */ |
567 | |
568 | #define ADD_PARM_SIZE(TO, INC) \ |
569 | do { \ |
570 | tree inc = (INC); \ |
571 | if (tree_fits_shwi_p (inc)) \ |
572 | (TO).constant += tree_to_shwi (inc); \ |
573 | else if ((TO).var == 0) \ |
574 | (TO).var = fold_convert (ssizetype, inc); \ |
575 | else \ |
576 | (TO).var = size_binop (PLUS_EXPR, (TO).var, \ |
577 | fold_convert (ssizetype, inc)); \ |
578 | } while (0) |
579 | |
580 | #define SUB_PARM_SIZE(TO, DEC) \ |
581 | do { \ |
582 | tree dec = (DEC); \ |
583 | if (tree_fits_shwi_p (dec)) \ |
584 | (TO).constant -= tree_to_shwi (dec); \ |
585 | else if ((TO).var == 0) \ |
586 | (TO).var = size_binop (MINUS_EXPR, ssize_int (0), \ |
587 | fold_convert (ssizetype, dec)); \ |
588 | else \ |
589 | (TO).var = size_binop (MINUS_EXPR, (TO).var, \ |
590 | fold_convert (ssizetype, dec)); \ |
591 | } while (0) |
592 | |
593 | /* Convert the implicit sum in a `struct args_size' into a tree |
594 | of type ssizetype. */ |
595 | #define ARGS_SIZE_TREE(SIZE) \ |
596 | ((SIZE).var == 0 ? ssize_int ((SIZE).constant) \ |
597 | : size_binop (PLUS_EXPR, fold_convert (ssizetype, (SIZE).var), \ |
598 | ssize_int ((SIZE).constant))) |
599 | |
600 | /* Convert the implicit sum in a `struct args_size' into an rtx. */ |
601 | #define ARGS_SIZE_RTX(SIZE) \ |
602 | ((SIZE).var == 0 ? gen_int_mode ((SIZE).constant, Pmode) \ |
603 | : expand_normal (ARGS_SIZE_TREE (SIZE))) |
604 | |
605 | #define ASLK_REDUCE_ALIGN 1 |
606 | #define ASLK_RECORD_PAD 2 |
607 | |
608 | /* If pointers to member functions use the least significant bit to |
609 | indicate whether a function is virtual, ensure a pointer |
610 | to this function will have that bit clear. */ |
611 | #define MINIMUM_METHOD_BOUNDARY \ |
612 | ((TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_pfn) \ |
613 | ? MAX (FUNCTION_BOUNDARY, 2 * BITS_PER_UNIT) : FUNCTION_BOUNDARY) |
614 | |
615 | enum stack_clash_probes { |
616 | NO_PROBE_NO_FRAME, |
617 | NO_PROBE_SMALL_FRAME, |
618 | PROBE_INLINE, |
619 | PROBE_LOOP |
620 | }; |
621 | |
622 | extern void dump_stack_clash_frame_info (enum stack_clash_probes, bool); |
623 | |
624 | |
625 | extern void push_function_context (void); |
626 | extern void pop_function_context (void); |
627 | |
628 | /* Save and restore status information for a nested function. */ |
629 | extern void free_after_parsing (struct function *); |
630 | extern void free_after_compilation (struct function *); |
631 | |
632 | /* Return size needed for stack frame based on slots so far allocated. |
633 | This size counts from zero. It is not rounded to STACK_BOUNDARY; |
634 | the caller may have to do that. */ |
635 | extern poly_int64 get_frame_size (void); |
636 | |
637 | /* Issue an error message and return TRUE if frame OFFSET overflows in |
638 | the signed target pointer arithmetics for function FUNC. Otherwise |
639 | return FALSE. */ |
640 | extern bool frame_offset_overflow (poly_int64, tree); |
641 | |
642 | extern unsigned int spill_slot_alignment (machine_mode); |
643 | |
644 | extern rtx assign_stack_local_1 (machine_mode, poly_int64, int, int); |
645 | extern rtx assign_stack_local (machine_mode, poly_int64, int); |
646 | extern rtx assign_stack_temp_for_type (machine_mode, poly_int64, tree); |
647 | extern rtx assign_stack_temp (machine_mode, poly_int64); |
648 | extern rtx assign_temp (tree, int, int); |
649 | extern void update_temp_slot_address (rtx, rtx); |
650 | extern void preserve_temp_slots (rtx); |
651 | extern void free_temp_slots (void); |
652 | extern void push_temp_slots (void); |
653 | extern void pop_temp_slots (void); |
654 | extern void init_temp_slots (void); |
655 | extern rtx get_hard_reg_initial_reg (rtx); |
656 | extern rtx get_hard_reg_initial_val (machine_mode, unsigned int); |
657 | extern rtx has_hard_reg_initial_val (machine_mode, unsigned int); |
658 | |
659 | /* Called from gimple_expand_cfg. */ |
660 | extern void emit_initial_value_sets (void); |
661 | |
662 | extern bool initial_value_entry (int i, rtx *, rtx *); |
663 | extern void instantiate_decl_rtl (rtx x); |
664 | extern bool aggregate_value_p (const_tree, const_tree); |
665 | extern bool use_register_for_decl (const_tree); |
666 | extern gimple_seq gimplify_parameters (gimple_seq *); |
667 | extern void locate_and_pad_parm (machine_mode, tree, int, int, int, |
668 | tree, struct args_size *, |
669 | struct locate_and_pad_arg_data *); |
670 | extern void generate_setjmp_warnings (void); |
671 | |
672 | /* Identify BLOCKs referenced by more than one NOTE_INSN_BLOCK_{BEG,END}, |
673 | and create duplicate blocks. */ |
674 | extern void reorder_blocks (void); |
675 | extern void clear_block_marks (tree); |
676 | extern tree blocks_nreverse (tree); |
677 | extern tree block_chainon (tree, tree); |
678 | |
679 | /* Set BLOCK_NUMBER for all the blocks in FN. */ |
680 | extern void number_blocks (tree); |
681 | |
682 | /* cfun shouldn't be set directly; use one of these functions instead. */ |
683 | extern void set_cfun (struct function *new_cfun, bool force = false); |
684 | extern void push_cfun (struct function *new_cfun); |
685 | extern void pop_cfun (void); |
686 | |
687 | extern int get_next_funcdef_no (void); |
688 | extern int get_last_funcdef_no (void); |
689 | extern void allocate_struct_function (tree, bool); |
690 | extern void push_struct_function (tree fndecl, bool = false); |
691 | extern void push_dummy_function (bool); |
692 | extern void pop_dummy_function (void); |
693 | extern void init_dummy_function_start (void); |
694 | extern void init_function_start (tree); |
695 | extern void stack_protect_epilogue (void); |
696 | extern void expand_function_start (tree); |
697 | extern void expand_dummy_function_end (void); |
698 | |
699 | extern void thread_prologue_and_epilogue_insns (void); |
700 | extern void diddle_return_value (void (*)(rtx, void*), void*); |
701 | extern void clobber_return_register (void); |
702 | extern void expand_function_end (void); |
703 | extern rtx get_arg_pointer_save_area (void); |
704 | extern void maybe_copy_prologue_epilogue_insn (rtx, rtx); |
705 | extern bool prologue_contains (const rtx_insn *); |
706 | extern bool epilogue_contains (const rtx_insn *); |
707 | extern bool prologue_epilogue_contains (const rtx_insn *); |
708 | extern void record_prologue_seq (rtx_insn *); |
709 | extern void record_epilogue_seq (rtx_insn *); |
710 | extern void emit_return_into_block (bool simple_p, basic_block bb); |
711 | extern void set_return_jump_label (rtx_insn *); |
712 | extern bool active_insn_between (rtx_insn *head, rtx_insn *tail); |
713 | extern vec<edge> convert_jumps_to_returns (basic_block last_bb, bool simple_p, |
714 | vec<edge> unconverted); |
715 | extern basic_block emit_return_for_exit (edge exit_fallthru_edge, |
716 | bool simple_p); |
717 | extern void reposition_prologue_and_epilogue_notes (void); |
718 | extern poly_int64 get_stack_dynamic_offset (); |
719 | |
720 | /* Returns the name of the current function. */ |
721 | extern const char *fndecl_name (tree); |
722 | extern const char *function_name (struct function *); |
723 | extern const char *current_function_name (void); |
724 | |
725 | extern void used_types_insert (tree); |
726 | |
727 | extern bool currently_expanding_function_start; |
728 | |
729 | #endif /* GCC_FUNCTION_H */ |
730 | |