]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/function.h
decl.c, [...]: Remove redundant enum from machine_mode.
[thirdparty/gcc.git] / gcc / function.h
CommitLineData
bf6beae5 1/* Structure for saving state for a nested function.
23a5b65a 2 Copyright (C) 1989-2014 Free Software Foundation, Inc.
bf6beae5 3
1322177d 4This file is part of GCC.
bf6beae5 5
1322177d
LB
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
9dcd6f09 8Software Foundation; either version 3, or (at your option) any later
1322177d 9version.
bf6beae5 10
1322177d
LB
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14for more details.
bf6beae5
CH
15
16You should have received a copy of the GNU General Public License
9dcd6f09
NC
17along 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 29struct 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 36struct 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
44 /* The ends of the doubly-linked chain of rtl for the current function.
45 Both are reset to null at the start of rtl generation for the function.
fa8db1f7 46
4dfa0342
RH
47 start_sequence saves both of these on `sequence_stack' and then starts
48 a new, nested sequence of insns. */
0926539c
DM
49 rtx_insn *x_first_insn;
50 rtx_insn *x_last_insn;
49ad7cfa 51
49ad7cfa
BS
52 /* Stack of pending (incomplete) sequences saved by `start_sequence'.
53 Each element describes one pending sequence.
54 The main insn-chain is saved in the last element of the chain,
55 unless the chain is empty. */
56 struct sequence_stack *sequence_stack;
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 87extern 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
JH
90#define reg_rtx_no (crtl->emit.x_reg_rtx_no)
91#define seq_stack (crtl->emit.sequence_stack)
49ad7cfa 92
3e029763 93#define REGNO_POINTER_ALIGN(REGNO) (crtl->emit.regno_pointer_align[REGNO])
49ad7cfa 94
d1b38208 95struct GTY(()) expr_status {
49ad7cfa
BS
96 /* Number of units that we should eventually pop off the stack.
97 These are the arguments to function calls that have already returned. */
98 int x_pending_stack_adjust;
99
100 /* Under some ABIs, it is the caller's responsibility to pop arguments
101 pushed for function calls. A naive implementation would simply pop
102 the arguments immediately after each call. However, if several
103 function calls are made in a row, it is typically cheaper to pop
104 all the arguments after all of the calls are complete since a
105 single pop instruction can be used. Therefore, GCC attempts to
106 defer popping the arguments until absolutely necessary. (For
107 example, at the end of a conditional, the arguments must be popped,
108 since code outside the conditional won't know whether or not the
109 arguments need to be popped.)
110
cc2902df 111 When INHIBIT_DEFER_POP is nonzero, however, the compiler does not
49ad7cfa
BS
112 attempt to defer pops. Instead, the stack is popped immediately
113 after each call. Rather then setting this variable directly, use
114 NO_DEFER_POP and OK_DEFER_POP. */
115 int x_inhibit_defer_pop;
116
1503a7ec 117 /* If PREFERRED_STACK_BOUNDARY and PUSH_ROUNDING are defined, the stack
98ef4163 118 boundary can be momentarily unaligned while pushing the arguments.
1503a7ec
JH
119 Record the delta since last aligned boundary here in order to get
120 stack alignment in the nested function calls working right. */
121 int x_stack_pointer_delta;
122
49ad7cfa
BS
123 /* Nonzero means __builtin_saveregs has already been done in this function.
124 The value is the pseudoreg containing the value __builtin_saveregs
125 returned. */
126 rtx x_saveregs_value;
127
128 /* Similarly for __builtin_apply_args. */
129 rtx x_apply_args_value;
130
131 /* List of labels that must never be deleted. */
e8c038ca 132 rtx_insn_list *x_forced_labels;
49ad7cfa
BS
133};
134
7e5487a2 135typedef struct call_site_record_d *call_site_record;
69c32ec8
JH
136
137/* RTL representation of exception handling. */
d1b38208 138struct GTY(()) rtl_eh {
69c32ec8
JH
139 rtx ehr_stackadj;
140 rtx ehr_handler;
f8b23302 141 rtx_code_label *ehr_label;
69c32ec8
JH
142
143 rtx sjlj_fc;
f8b23302 144 rtx_insn *sjlj_exit_after;
69c32ec8 145
9771b263 146 vec<uchar, va_gc> *action_record_data;
69c32ec8 147
9771b263 148 vec<call_site_record, va_gc> *call_site_record_v[2];
69c32ec8
JH
149};
150
3e029763
JH
151#define pending_stack_adjust (crtl->expr.x_pending_stack_adjust)
152#define inhibit_defer_pop (crtl->expr.x_inhibit_defer_pop)
153#define saveregs_value (crtl->expr.x_saveregs_value)
154#define apply_args_value (crtl->expr.x_apply_args_value)
155#define forced_labels (crtl->expr.x_forced_labels)
156#define stack_pointer_delta (crtl->expr.x_stack_pointer_delta)
49ad7cfa 157
5cd4ec7f 158struct gimple_df;
6370682a
KH
159struct temp_slot;
160typedef struct temp_slot *temp_slot_p;
7e5487a2 161struct call_site_record_d;
84562394 162struct dw_fde_node;
6370682a 163
6a5ac314
OE
164class ipa_opt_pass_d;
165typedef ipa_opt_pass_d *ipa_opt_pass;
17653c00 166
6370682a 167
d1b38208 168struct GTY(()) varasm_status {
bd60bab2
JH
169 /* If we're using a per-function constant pool, this is it. */
170 struct rtx_constant_pool *pool;
171
172 /* Number of tree-constants deferred during the expansion of this
173 function. */
174 unsigned int deferred_constants;
175};
176
38173d38 177/* Information mainlined about RTL representation of incoming arguments. */
d1b38208 178struct GTY(()) incoming_args {
38173d38
JH
179 /* Number of bytes of args popped by function being compiled on its return.
180 Zero if no bytes are to be popped.
181 May affect compilation of return insn or of function epilogue. */
182 int pops_args;
183
184 /* If function's args have a fixed size, this is that size, in bytes.
185 Otherwise, it is -1.
186 May affect compilation of return insn or of function epilogue. */
187 int size;
188
189 /* # bytes the prologue should push and pretend that the caller pushed them.
190 The prologue must do this, but only if parms can be passed in
191 registers. */
192 int pretend_args_size;
193
194 /* This is the offset from the arg pointer to the place where the first
195 anonymous arg can be found, if there is one. */
196 rtx arg_offset_rtx;
197
198 /* Quantities of various kinds of registers
199 used for the current function's args. */
200 CUMULATIVE_ARGS info;
201
202 /* The arg pointer hard register, or the pseudo into which it was copied. */
203 rtx internal_arg_pointer;
204};
205
206/* Data for function partitioning. */
d1b38208 207struct GTY(()) function_subsections {
38173d38
JH
208 /* Assembly labels for the hot and cold text sections, to
209 be used by debugger functions for determining the size of text
210 sections. */
211
212 const char *hot_section_label;
213 const char *cold_section_label;
214 const char *hot_section_end_label;
215 const char *cold_section_end_label;
38173d38
JH
216};
217
56731d64
BS
218/* Describe an empty area of space in the stack frame. These can be chained
219 into a list; this is used to keep track of space wasted for alignment
220 reasons. */
221struct GTY(()) frame_space
222{
223 struct frame_space *next;
224
225 HOST_WIDE_INT start;
226 HOST_WIDE_INT length;
227};
228
bd60bab2 229/* Datastructures maintained for currently processed function in RTL form. */
d1b38208 230struct GTY(()) rtl_data {
bd60bab2
JH
231 struct expr_status expr;
232 struct emit_status emit;
233 struct varasm_status varasm;
38173d38
JH
234 struct incoming_args args;
235 struct function_subsections subsections;
69c32ec8 236 struct rtl_eh eh;
38173d38
JH
237
238 /* For function.c */
239
240 /* # of bytes of outgoing arguments. If ACCUMULATE_OUTGOING_ARGS is
241 defined, the needed space is pushed by the prologue. */
242 int outgoing_args_size;
243
244 /* If nonzero, an RTL expression for the location at which the current
245 function returns its result. If the current function returns its
246 result in a register, current_function_return_rtx will always be
247 the hard register containing the result. */
248 rtx return_rtx;
249
6399c0ab
SB
250 /* Vector of initial-value pairs. Each pair consists of a pseudo
251 register of approprite mode that stores the initial value a hard
252 register REGNO, and that hard register itself. */
253 /* ??? This could be a VEC but there is currently no way to define an
254 opaque VEC type. */
38173d38 255 struct initial_value_struct *hard_reg_initial_vals;
bd60bab2 256
cb91fab0
JH
257 /* A variable living at the top of the frame that holds a known value.
258 Used for detecting stack clobbers. */
259 tree stack_protect_guard;
260
b5241a5a 261 /* List (chain of INSN_LIST) of labels heading the current handlers for
bd60bab2 262 nonlocal gotos. */
b5241a5a 263 rtx_insn_list *x_nonlocal_goto_handler_labels;
bd60bab2
JH
264
265 /* Label that will go on function epilogue.
266 Jumping to this label serves as a "return" instruction
267 on machines which require execution of the epilogue on all returns. */
f48bd60e 268 rtx_code_label *x_return_label;
bd60bab2
JH
269
270 /* Label that will go on the end of function epilogue.
271 Jumping to this label serves as a "naked return" instruction
272 on machines which require execution of the epilogue on all returns. */
f48bd60e 273 rtx_code_label *x_naked_return_label;
bd60bab2
JH
274
275 /* List (chain of EXPR_LISTs) of all stack slots in this function.
cb91fab0 276 Made for the sake of unshare_all_rtl. */
0f4783c7 277 rtx_expr_list *x_stack_slot_list;
bd60bab2 278
56731d64
BS
279 /* List of empty areas in the stack frame. */
280 struct frame_space *frame_space_list;
281
bd60bab2 282 /* Place after which to insert the tail_recursion_label if we need one. */
66e8df53 283 rtx_note *x_stack_check_probe_note;
bd60bab2
JH
284
285 /* Location at which to save the argument pointer if it will need to be
286 referenced. There are two cases where this is done: if nonlocal gotos
287 exist, or if vars stored at an offset from the argument pointer will be
288 needed by inner routines. */
289 rtx x_arg_pointer_save_area;
290
2e3f842f
L
291 /* Dynamic Realign Argument Pointer used for realigning stack. */
292 rtx drap_reg;
293
bd60bab2
JH
294 /* Offset to end of allocated area of stack frame.
295 If stack grows down, this is the address of the last stack slot allocated.
296 If stack grows up, this is the address for the next slot. */
297 HOST_WIDE_INT x_frame_offset;
298
299 /* Insn after which register parms and SAVE_EXPRs are born, if nonopt. */
7a688d52 300 rtx_insn *x_parm_birth_insn;
bd60bab2
JH
301
302 /* List of all used temporaries allocated, by level. */
9771b263 303 vec<temp_slot_p, va_gc> *x_used_temp_slots;
bd60bab2
JH
304
305 /* List of available temp slots. */
306 struct temp_slot *x_avail_temp_slots;
307
308 /* Current nesting level for temporaries. */
309 int x_temp_slot_level;
310
2e3f842f
L
311 /* The largest alignment needed on the stack, including requirement
312 for outgoing stack alignment. */
cb91fab0
JH
313 unsigned int stack_alignment_needed;
314
2e3f842f
L
315 /* Preferred alignment of the end of stack frame, which is preferred
316 to call other functions. */
cb91fab0
JH
317 unsigned int preferred_stack_boundary;
318
e94a448f
L
319 /* The minimum alignment of parameter stack. */
320 unsigned int parm_stack_boundary;
321
2e3f842f
L
322 /* The largest alignment of slot allocated on the stack. */
323 unsigned int max_used_stack_slot_alignment;
324
325 /* The stack alignment estimated before reload, with consideration of
326 following factors:
327 1. Alignment of local stack variables (max_used_stack_slot_alignment)
b8698a0f 328 2. Alignment requirement to call other functions
2e3f842f
L
329 (preferred_stack_boundary)
330 3. Alignment of non-local stack variables but might be spilled in
331 local stack. */
332 unsigned int stack_alignment_estimated;
333
cb91fab0
JH
334 /* For reorg. */
335
e3b5732b
JH
336 /* Nonzero if function being compiled called builtin_return_addr or
337 builtin_frame_address with nonzero count. */
338 bool accesses_prior_frames;
339
340 /* Nonzero if the function calls __builtin_eh_return. */
341 bool calls_eh_return;
342
343 /* Nonzero if function saves all registers, e.g. if it has a nonlocal
344 label that can reach the exit block via non-exceptional paths. */
345 bool saves_all_registers;
346
347 /* Nonzero if function being compiled has nonlocal gotos to parent
348 function. */
349 bool has_nonlocal_goto;
b8698a0f 350
e3b5732b
JH
351 /* Nonzero if function being compiled has an asm statement. */
352 bool has_asm_statement;
353
e3b5732b
JH
354 /* This bit is used by the exception handling logic. It is set if all
355 calls (if any) are sibling calls. Such functions do not have to
356 have EH tables generated, as they cannot throw. A call to such a
357 function, however, should be treated as throwing if any of its callees
358 can throw. */
359 bool all_throwers_are_sibcalls;
360
361 /* Nonzero if stack limit checking should be enabled in the current
362 function. */
363 bool limit_stack;
364
365 /* Nonzero if profiling code should be generated. */
366 bool profile;
367
368 /* Nonzero if the current function uses the constant pool. */
369 bool uses_const_pool;
370
371 /* Nonzero if the current function uses pic_offset_table_rtx. */
372 bool uses_pic_offset_table;
373
374 /* Nonzero if the current function needs an lsda for exception handling. */
375 bool uses_eh_lsda;
376
377 /* Set when the tail call has been produced. */
378 bool tail_call_emit;
379
380 /* Nonzero if code to initialize arg_pointer_save_area has been emitted. */
381 bool arg_pointer_save_area_init;
3bffa195 382
2e3f842f 383 /* Nonzero if current function must be given a frame pointer.
aeb9f7cf
SB
384 Set in reload1.c or lra-eliminations.c if anything is allocated
385 on the stack there. */
3bffa195 386 bool frame_pointer_needed;
bf08ebeb
JH
387
388 /* When set, expand should optimize for speed. */
389 bool maybe_hot_insn_p;
2e3f842f 390
d2d93c32
L
391 /* Nonzero if function stack realignment is needed. This flag may be
392 set twice: before and after reload. It is set before reload wrt
393 stack alignment estimation before reload. It will be changed after
394 reload if by then criteria of stack realignment is different.
2e3f842f
L
395 The value set after reload is the accurate one and is finalized. */
396 bool stack_realign_needed;
397
d2d93c32
L
398 /* Nonzero if function stack realignment is tried. This flag is set
399 only once before reload. It affects register elimination. This
400 is used to generate DWARF debug info for stack variables. */
401 bool stack_realign_tried;
402
2e3f842f
L
403 /* Nonzero if function being compiled needs dynamic realigned
404 argument pointer (drap) if stack needs realigning. */
405 bool need_drap;
406
407 /* Nonzero if function stack realignment estimation is done, namely
d2d93c32
L
408 stack_realign_needed flag has been set before reload wrt estimated
409 stack alignment info. */
2e3f842f
L
410 bool stack_realign_processed;
411
412 /* Nonzero if function stack realignment has been finalized, namely
413 stack_realign_needed flag has been set and finalized after reload. */
414 bool stack_realign_finalized;
84b9b872
RS
415
416 /* True if dbr_schedule has already been called for this function. */
417 bool dbr_scheduled_p;
fe89fbc5
JH
418
419 /* True if current function can not throw. Unlike
420 TREE_NOTHROW (current_function_decl) it is set even for overwritable
421 function where currently compiled version of it is nothrow. */
422 bool nothrow;
b748fbd6 423
484db665
BS
424 /* True if we performed shrink-wrapping for the current function. */
425 bool shrink_wrapped;
426
416ff32e
SB
427 /* Nonzero if function being compiled doesn't modify the stack pointer
428 (ignoring the prologue and epilogue). This is only valid after
429 pass_stack_ptr_mod has run. */
430 bool sp_is_unchanging;
431
432 /* Nonzero if function being compiled doesn't contain any calls
433 (ignoring the prologue and epilogue). This is set prior to
434 local register allocation and is valid for the remaining
435 compiler passes. */
436 bool is_leaf;
437
438 /* Nonzero if the function being compiled is a leaf function which only
439 uses leaf registers. This is valid after reload (specifically after
440 sched2) and is useful only if the port defines LEAF_REGISTERS. */
441 bool uses_only_leaf_regs;
442
af205f67
TJ
443 /* Nonzero if the function being compiled has undergone hot/cold partitioning
444 (under flag_reorder_blocks_and_partition) and has at least one cold
445 block. */
446 bool has_bb_partition;
447
448 /* Nonzero if the function being compiled has completed the bb reordering
449 pass. */
450 bool bb_reorder_complete;
451
b748fbd6
PB
452 /* Like regs_ever_live, but 1 if a reg is set or clobbered from an
453 asm. Unlike regs_ever_live, elements of this array corresponding
454 to eliminable regs (like the frame pointer) are set if an asm
455 sets them. */
456 HARD_REG_SET asm_clobbers;
bd60bab2
JH
457};
458
3e029763
JH
459#define return_label (crtl->x_return_label)
460#define naked_return_label (crtl->x_naked_return_label)
461#define stack_slot_list (crtl->x_stack_slot_list)
462#define parm_birth_insn (crtl->x_parm_birth_insn)
463#define frame_offset (crtl->x_frame_offset)
464#define stack_check_probe_note (crtl->x_stack_check_probe_note)
465#define arg_pointer_save_area (crtl->x_arg_pointer_save_area)
466#define used_temp_slots (crtl->x_used_temp_slots)
467#define avail_temp_slots (crtl->x_avail_temp_slots)
468#define temp_slot_level (crtl->x_temp_slot_level)
469#define nonlocal_goto_handler_labels (crtl->x_nonlocal_goto_handler_labels)
3bffa195 470#define frame_pointer_needed (crtl->frame_pointer_needed)
2e3f842f
L
471#define stack_realign_fp (crtl->stack_realign_needed && !crtl->need_drap)
472#define stack_realign_drap (crtl->stack_realign_needed && crtl->need_drap)
3e029763
JH
473
474extern GTY(()) struct rtl_data x_rtl;
475
fa10beec 476/* Accessor to RTL datastructures. We keep them statically allocated now since
3e029763 477 we never keep multiple functions. For threaded compiler we might however
fa10beec 478 want to do differently. */
3e029763 479#define crtl (&x_rtl)
bd60bab2 480
d3c12306
EB
481struct GTY(()) stack_usage
482{
483 /* # of bytes of static stack space allocated by the function. */
484 HOST_WIDE_INT static_stack_size;
485
486 /* # of bytes of dynamic stack space allocated by the function. This is
487 meaningful only if has_unbounded_dynamic_stack_size is zero. */
488 HOST_WIDE_INT dynamic_stack_size;
489
490 /* # of bytes of space pushed onto the stack after the prologue. If
491 !ACCUMULATE_OUTGOING_ARGS, it contains the outgoing arguments. */
492 int pushed_stack_size;
493
d3c12306
EB
494 /* Nonzero if the amount of stack space allocated dynamically cannot
495 be bounded at compile-time. */
496 unsigned int has_unbounded_dynamic_stack_size : 1;
497};
498
499#define current_function_static_stack_size (cfun->su->static_stack_size)
500#define current_function_dynamic_stack_size (cfun->su->dynamic_stack_size)
501#define current_function_pushed_stack_size (cfun->su->pushed_stack_size)
d3c12306
EB
502#define current_function_has_unbounded_dynamic_stack_size \
503 (cfun->su->has_unbounded_dynamic_stack_size)
504#define current_function_allocates_dynamic_stack_space \
505 (current_function_dynamic_stack_size != 0 \
506 || current_function_has_unbounded_dynamic_stack_size)
507
bf6beae5
CH
508/* This structure can save all the important global and static variables
509 describing the status of the current function. */
510
d1b38208 511struct GTY(()) function {
b384405b
BS
512 struct eh_status *eh;
513
997de8ed
SB
514 /* The control flow graph for this function. */
515 struct control_flow_graph *cfg;
726a989a
RB
516
517 /* GIMPLE body for this function. */
355a7673 518 gimple_seq gimple_body;
726a989a 519
5cd4ec7f
JH
520 /* SSA and dataflow information. */
521 struct gimple_df *gimple_df;
997de8ed 522
598ec7bd 523 /* The loops in this function. */
9e2f83a5 524 struct loops *x_current_loops;
598ec7bd 525
d3c12306
EB
526 /* The stack usage of this function. */
527 struct stack_usage *su;
528
6946b3f7
JH
529 /* Value histograms attached to particular statements. */
530 htab_t GTY((skip)) value_histograms;
531
bf6beae5 532 /* For function.c. */
49ad7cfa 533
19eb1ad7 534 /* Points to the FUNCTION_DECL of this function. */
bf6beae5 535 tree decl;
49ad7cfa 536
1a837f77 537 /* A PARM_DECL that should contain the static chain for this function.
6de9cd9a
DN
538 It will be initialized at the beginning of the function. */
539 tree static_chain_decl;
49ad7cfa 540
6de9cd9a 541 /* An expression that contains the non-local goto save area. The first
b8698a0f 542 word is the saved frame pointer and the second is the saved stack
6de9cd9a
DN
543 pointer. */
544 tree nonlocal_goto_save_area;
49ad7cfa 545
c021f10b 546 /* Vector of function local variables, functions, types and constants. */
9771b263 547 vec<tree, va_gc> *local_decls;
cb91fab0 548
939b37da
BI
549 /* In a Cilk function, the VAR_DECL for the frame descriptor. */
550 tree cilk_frame_decl;
551
bf6beae5 552 /* For md files. */
49ad7cfa 553
d6e1b011 554 /* tm.h can use this to store whatever it likes. */
1431042e 555 struct machine_function * GTY ((maybe_undef)) machine;
55dea919 556
8c5666b4 557 /* Language-specific code can use this to store whatever it likes. */
e2500fed 558 struct language_function * language;
8c5666b4 559
33c9159e 560 /* Used types hash table. */
b086d530 561 hash_set<tree> *GTY (()) used_types_hash;
33c9159e 562
a518b996
RH
563 /* Dwarf2 Frame Description Entry, containing the Call Frame Instructions
564 used for unwinding. Only set when either dwarf2 unwinding or dwarf2
565 debugging is enabled. */
84562394 566 struct dw_fde_node *fde;
a518b996 567
908ff6a3
KZ
568 /* Last statement uid. */
569 int last_stmt_uid;
570
3691626c
RG
571 /* Function sequence number for profiling, debugging, etc. */
572 int funcdef_no;
573
1751ecd6
AH
574 /* Line number of the start of the function for debugging purposes. */
575 location_t function_start_locus;
576
6de9cd9a
DN
577 /* Line number of the end of the function. */
578 location_t function_end_locus;
579
a5093353
JH
580 /* Properties used by the pass manager. */
581 unsigned int curr_properties;
582 unsigned int last_verified;
27dbd3ac 583
27dbd3ac
RH
584 /* Non-null if the function does something that would prevent it from
585 being copied; this applies to both versioning and inlining. Set to
586 a string describing the reason for failure. */
587 const char * GTY((skip)) cannot_be_copied_reason;
588
89996b6e
RH
589 /* Collected bit flags. */
590
ecaebb9e
NS
591 /* Number of units of general registers that need saving in stdarg
592 function. What unit is depends on the backend, either it is number
593 of bytes, or it can be number of registers. */
594 unsigned int va_list_gpr_size : 8;
595
596 /* Number of units of floating point registers that need saving in stdarg
597 function. */
598 unsigned int va_list_fpr_size : 8;
599
89996b6e
RH
600 /* Nonzero if function being compiled can call setjmp. */
601 unsigned int calls_setjmp : 1;
602
89996b6e
RH
603 /* Nonzero if function being compiled can call alloca,
604 either as a subroutine or builtin. */
605 unsigned int calls_alloca : 1;
606
939b37da
BI
607 /* This will indicate whether a function is a cilk function */
608 unsigned int is_cilk_function : 1;
609
610 /* Nonzero if this is a Cilk function that spawns. */
611 unsigned int calls_cilk_spawn : 1;
612
89996b6e
RH
613 /* Nonzero if function being compiled receives nonlocal gotos
614 from nested functions. */
615 unsigned int has_nonlocal_label : 1;
616
b8698a0f 617 /* Nonzero if we've set cannot_be_copied_reason. I.e. if
27dbd3ac
RH
618 (cannot_be_copied_set && !cannot_be_copied_reason), the function
619 can in fact be copied. */
620 unsigned int cannot_be_copied_set : 1;
621
6c535c69 622 /* Nonzero if current function uses stdarg.h or equivalent. */
89996b6e
RH
623 unsigned int stdarg : 1;
624
55dea919 625 unsigned int after_inlining : 1;
0889e9bc 626 unsigned int always_inline_functions_inlined : 1;
55dea919 627
8f4f502f
EB
628 /* Nonzero if function being compiled can throw synchronous non-call
629 exceptions. */
630 unsigned int can_throw_non_call_exceptions : 1;
631
2da02156
EB
632 /* Nonzero if instructions that may throw exceptions but don't otherwise
633 contribute to the execution of the program can be deleted. */
634 unsigned int can_delete_dead_exceptions : 1;
635
182e0d71
AK
636 /* Fields below this point are not set for abstract functions; see
637 allocate_struct_function. */
638
639 /* Nonzero if function being compiled needs to be given an address
640 where the value should be stored. */
641 unsigned int returns_struct : 1;
642
643 /* Nonzero if function being compiled needs to
644 return the address of where it has put a structure value. */
645 unsigned int returns_pcc_struct : 1;
135a171d 646
fc3103e7
JJ
647 /* Nonzero if this function has local DECL_HARD_REGISTER variables.
648 In this case code motion has to be done more carefully. */
649 unsigned int has_local_explicit_reg_vars : 1;
3c072c6b
JY
650
651 /* Nonzero if the current function is a thunk, i.e., a lightweight
652 function implemented by the output_mi_thunk hook) that just
653 adjusts one of its arguments and forwards to another
654 function. */
655 unsigned int is_thunk : 1;
74bf76ed
JJ
656
657 /* Nonzero if the current function contains any loops with
b15b5979
EB
658 loop->force_vectorize set. */
659 unsigned int has_force_vectorize_loops : 1;
74bf76ed
JJ
660
661 /* Nonzero if the current function contains any loops with
662 nonzero value in loop->simduid. */
663 unsigned int has_simduid_loops : 1;
e2f0f5f7
JJ
664
665 /* Set when the tail call has been identified. */
666 unsigned int tail_call_marked : 1;
bf6beae5
CH
667};
668
c021f10b
NF
669/* Add the decl D to the local_decls list of FUN. */
670
671static inline void
672add_local_decl (struct function *fun, tree d)
673{
9771b263 674 vec_safe_push (fun->local_decls, d);
c021f10b
NF
675}
676
677#define FOR_EACH_LOCAL_DECL(FUN, I, D) \
9771b263 678 FOR_EACH_VEC_SAFE_ELT_REVERSE ((FUN)->local_decls, I, D)
c021f10b 679
9d30f3c1
JJ
680/* If va_list_[gf]pr_size is set to this, it means we don't know how
681 many units need to be saved. */
682#define VA_LIST_MAX_GPR_SIZE 255
683#define VA_LIST_MAX_FPR_SIZE 255
684
01d939e8 685/* The function currently being compiled. */
e2500fed 686extern GTY(()) struct function *cfun;
01d939e8 687
5576d6f2
TT
688/* In order to ensure that cfun is not set directly, we redefine it so
689 that it is not an lvalue. Rather than assign to cfun, use
690 push_cfun or set_cfun. */
691#define cfun (cfun + 0)
692
c39ada04
DD
693/* Nonzero if we've already converted virtual regs to hard regs. */
694extern int virtuals_instantiated;
695
3edc56a9
JJ
696/* Nonzero if at least one trampoline has been created. */
697extern int trampolines_created;
698
2a22f99c 699struct GTY((for_user)) types_used_by_vars_entry {
b646ba3f
DS
700 tree type;
701 tree var_decl;
702};
703
2a22f99c
TS
704struct used_type_hasher : ggc_hasher<types_used_by_vars_entry *>
705{
706 static hashval_t hash (types_used_by_vars_entry *);
707 static bool equal (types_used_by_vars_entry *, types_used_by_vars_entry *);
708};
709
b646ba3f
DS
710/* Hash table making the relationship between a global variable
711 and the types it references in its initializer. The key of the
712 entry is a referenced type, and the value is the DECL of the global
713 variable. types_use_by_vars_do_hash and types_used_by_vars_eq below are
714 the hash and equality functions to use for this hash table. */
2a22f99c 715extern GTY(()) hash_table<used_type_hasher> *types_used_by_vars_hash;
b646ba3f 716
b646ba3f
DS
717void types_used_by_var_decl_insert (tree type, tree var_decl);
718
bc87224e
NF
719/* During parsing of a global variable, this vector contains the types
720 referenced by the global variable. */
9771b263 721extern GTY(()) vec<tree, va_gc> *types_used_by_cur_var_decl;
b646ba3f 722
db2960f4 723
0fc822d0
RB
724/* Return the loop tree of FN. */
725
726inline struct loops *
727loops_for_fn (struct function *fn)
728{
729 return fn->x_current_loops;
730}
731
732/* Set the loop tree of FN to LOOPS. */
733
734inline void
735set_loops_for_fn (struct function *fn, struct loops *loops)
736{
737 gcc_checking_assert (fn->x_current_loops == NULL || loops == NULL);
738 fn->x_current_loops = loops;
739}
740
49ad7cfa 741/* For backward compatibility... eventually these should all go away. */
df696a75 742#define current_function_funcdef_no (cfun->funcdef_no)
01d939e8 743
598ec7bd 744#define current_loops (cfun->x_current_loops)
8fee41c2
ZD
745#define dom_computed (cfun->cfg->x_dom_computed)
746#define n_bbs_in_dom_tree (cfun->cfg->x_n_bbs_in_dom_tree)
6946b3f7 747#define VALUE_HISTOGRAMS(fun) (fun)->value_histograms
bf6beae5 748
83685514
AM
749/* A pointer to a function to create target specific, per-function
750 data structures. */
751extern struct machine_function * (*init_machine_status) (void);
d6e1b011 752
83685514 753enum direction {none, upward, downward};
18c038b9 754
83685514
AM
755/* Structure to record the size of a sequence of arguments
756 as the sum of a tree-expression and a constant. This structure is
757 also used to store offsets from the stack, which might be negative,
758 so the variable part must be ssizetype, not sizetype. */
759
760struct args_size
761{
762 HOST_WIDE_INT constant;
763 tree var;
764};
765
766/* Package up various arg related fields of struct args for
767 locate_and_pad_parm. */
768struct locate_and_pad_arg_data
769{
770 /* Size of this argument on the stack, rounded up for any padding it
771 gets. If REG_PARM_STACK_SPACE is defined, then register parms are
772 counted here, otherwise they aren't. */
773 struct args_size size;
774 /* Offset of this argument from beginning of stack-args. */
775 struct args_size offset;
776 /* Offset to the start of the stack slot. Different from OFFSET
777 if this arg pads downward. */
778 struct args_size slot_offset;
779 /* The amount that the stack pointer needs to be adjusted to
780 force alignment for the next argument. */
781 struct args_size alignment_pad;
782 /* Which way we should pad this arg. */
783 enum direction where_pad;
784 /* slot_offset is at least this aligned. */
785 unsigned int boundary;
786};
787
788/* Add the value of the tree INC to the `struct args_size' TO. */
789
790#define ADD_PARM_SIZE(TO, INC) \
791do { \
792 tree inc = (INC); \
793 if (tree_fits_shwi_p (inc)) \
794 (TO).constant += tree_to_shwi (inc); \
795 else if ((TO).var == 0) \
796 (TO).var = fold_convert (ssizetype, inc); \
797 else \
798 (TO).var = size_binop (PLUS_EXPR, (TO).var, \
799 fold_convert (ssizetype, inc)); \
800} while (0)
801
802#define SUB_PARM_SIZE(TO, DEC) \
803do { \
804 tree dec = (DEC); \
805 if (tree_fits_shwi_p (dec)) \
806 (TO).constant -= tree_to_shwi (dec); \
807 else if ((TO).var == 0) \
808 (TO).var = size_binop (MINUS_EXPR, ssize_int (0), \
809 fold_convert (ssizetype, dec)); \
810 else \
811 (TO).var = size_binop (MINUS_EXPR, (TO).var, \
812 fold_convert (ssizetype, dec)); \
813} while (0)
814
815/* Convert the implicit sum in a `struct args_size' into a tree
816 of type ssizetype. */
817#define ARGS_SIZE_TREE(SIZE) \
818((SIZE).var == 0 ? ssize_int ((SIZE).constant) \
819 : size_binop (PLUS_EXPR, fold_convert (ssizetype, (SIZE).var), \
820 ssize_int ((SIZE).constant)))
821
822/* Convert the implicit sum in a `struct args_size' into an rtx. */
823#define ARGS_SIZE_RTX(SIZE) \
824((SIZE).var == 0 ? GEN_INT ((SIZE).constant) \
825 : expand_normal (ARGS_SIZE_TREE (SIZE)))
826
827#define ASLK_REDUCE_ALIGN 1
828#define ASLK_RECORD_PAD 2
829
830\f
831
832extern void push_function_context (void);
833extern void pop_function_context (void);
834
835/* Save and restore status information for a nested function. */
836extern void free_after_parsing (struct function *);
837extern void free_after_compilation (struct function *);
6de9cd9a 838
9a807d3a
RK
839/* Return size needed for stack frame based on slots so far allocated.
840 This size counts from zero. It is not rounded to STACK_BOUNDARY;
841 the caller may have to do that. */
fa8db1f7 842extern HOST_WIDE_INT get_frame_size (void);
9a807d3a 843
9fb798d7
EB
844/* Issue an error message and return TRUE if frame OFFSET overflows in
845 the signed target pointer arithmetics for function FUNC. Otherwise
846 return FALSE. */
847extern bool frame_offset_overflow (HOST_WIDE_INT, tree);
848
ef4bddc2
RS
849extern rtx assign_stack_local_1 (machine_mode, HOST_WIDE_INT, int, int);
850extern rtx assign_stack_local (machine_mode, HOST_WIDE_INT, int);
851extern rtx assign_stack_temp_for_type (machine_mode, HOST_WIDE_INT, tree);
852extern rtx assign_stack_temp (machine_mode, HOST_WIDE_INT);
83685514
AM
853extern rtx assign_temp (tree, int, int);
854extern void update_temp_slot_address (rtx, rtx);
855extern void preserve_temp_slots (rtx);
856extern void free_temp_slots (void);
857extern void push_temp_slots (void);
858extern void pop_temp_slots (void);
859extern void init_temp_slots (void);
860extern rtx get_hard_reg_initial_reg (rtx);
ef4bddc2
RS
861extern rtx get_hard_reg_initial_val (machine_mode, unsigned int);
862extern rtx has_hard_reg_initial_val (machine_mode, unsigned int);
ba534a45 863
83685514
AM
864/* Called from gimple_expand_cfg. */
865extern unsigned int emit_initial_value_sets (void);
866
867extern bool initial_value_entry (int i, rtx *, rtx *);
868extern void instantiate_decl_rtl (rtx x);
869extern int aggregate_value_p (const_tree, const_tree);
870extern bool use_register_for_decl (const_tree);
ef4bddc2 871extern bool pass_by_reference (CUMULATIVE_ARGS *, machine_mode,
83685514 872 tree, bool);
ef4bddc2 873extern bool reference_callee_copied (CUMULATIVE_ARGS *, machine_mode,
83685514
AM
874 tree, bool);
875extern gimple_seq gimplify_parameters (void);
ef4bddc2 876extern void locate_and_pad_parm (machine_mode, tree, int, int, int,
83685514
AM
877 tree, struct args_size *,
878 struct locate_and_pad_arg_data *);
879extern void generate_setjmp_warnings (void);
880
881/* Identify BLOCKs referenced by more than one NOTE_INSN_BLOCK_{BEG,END},
882 and create duplicate blocks. */
883extern void reorder_blocks (void);
884extern void clear_block_marks (tree);
885extern tree blocks_nreverse (tree);
886extern tree block_chainon (tree, tree);
a00b8dfa 887
83685514
AM
888/* Set BLOCK_NUMBER for all the blocks in FN. */
889extern void number_blocks (tree);
890
891/* cfun shouldn't be set directly; use one of these functions instead. */
892extern void set_cfun (struct function *new_cfun);
893extern void push_cfun (struct function *new_cfun);
894extern void pop_cfun (void);
895
896extern int get_next_funcdef_no (void);
897extern int get_last_funcdef_no (void);
898extern void allocate_struct_function (tree, bool);
899extern void push_struct_function (tree fndecl);
900extern void init_dummy_function_start (void);
901extern void init_function_start (tree);
902extern void stack_protect_epilogue (void);
903extern void expand_function_start (tree);
904extern void expand_dummy_function_end (void);
fa51b01b 905
bd695e1e 906#ifdef RTX_CODE
fa8db1f7
AJ
907extern void diddle_return_value (void (*)(rtx, void*), void*);
908extern void clobber_return_register (void);
bd695e1e
RH
909#endif
910
83685514
AM
911extern void do_warn_unused_parameter (tree);
912extern void expand_function_end (void);
bd60bab2 913extern rtx get_arg_pointer_save_area (void);
83685514
AM
914extern void maybe_copy_prologue_epilogue_insn (rtx, rtx);
915extern int prologue_epilogue_contains (const_rtx);
916extern void emit_return_into_block (bool simple_p, basic_block bb);
917extern void set_return_jump_label (rtx);
918extern bool active_insn_between (rtx_insn *head, rtx_insn *tail);
919extern vec<edge> convert_jumps_to_returns (basic_block last_bb, bool simple_p,
920 vec<edge> unconverted);
921extern basic_block emit_return_for_exit (edge exit_fallthru_edge,
922 bool simple_p);
923extern void reposition_prologue_and_epilogue_notes (void);
278ed218 924
faed5cc3 925/* Returns the name of the current function. */
df92c640 926extern const char *fndecl_name (tree);
532aafad 927extern const char *function_name (struct function *);
faed5cc3
SB
928extern const char *current_function_name (void);
929
8d8d1a28 930extern void used_types_insert (tree);
33c9159e 931
264fa2db 932#endif /* GCC_FUNCTION_H */