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