runtime: set library name based on compiler name
[official-gcc.git] / gcc / function.h
blob3a6305ca700bfebf366c6a57cc754d6b84fcdd65
1 /* Structure for saving state for a nested function.
2 Copyright (C) 1989-2014 Free Software Foundation, Inc.
4 This file is part of GCC.
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.
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.
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/>. */
20 #ifndef GCC_FUNCTION_H
21 #define GCC_FUNCTION_H
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. */
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;
36 struct GTY(()) emit_status {
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;
41 /* Lowest label number in current function. */
42 int x_first_label_num;
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.
47 start_sequence saves both of these on `sequence_stack' and then starts
48 a new, nested sequence of insns. */
49 rtx_insn *x_first_insn;
50 rtx_insn *x_last_insn;
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;
58 /* INSN_UID for next insn emitted.
59 Reset to 1 for each function compiled. */
60 int x_cur_insn_uid;
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;
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;
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;
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.
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. */
87 extern GTY ((length ("crtl->emit.x_reg_rtx_no"))) rtx * regno_reg_rtx;
89 /* For backward compatibility... eventually these should all go away. */
90 #define reg_rtx_no (crtl->emit.x_reg_rtx_no)
91 #define seq_stack (crtl->emit.sequence_stack)
93 #define REGNO_POINTER_ALIGN(REGNO) (crtl->emit.regno_pointer_align[REGNO])
95 struct GTY(()) expr_status {
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;
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.)
111 When INHIBIT_DEFER_POP is nonzero, however, the compiler does not
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;
117 /* If PREFERRED_STACK_BOUNDARY and PUSH_ROUNDING are defined, the stack
118 boundary can be momentarily unaligned while pushing the arguments.
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;
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;
128 /* Similarly for __builtin_apply_args. */
129 rtx x_apply_args_value;
131 /* List of labels that must never be deleted. */
132 rtx_insn_list *x_forced_labels;
135 typedef struct call_site_record_d *call_site_record;
137 /* RTL representation of exception handling. */
138 struct GTY(()) rtl_eh {
139 rtx ehr_stackadj;
140 rtx ehr_handler;
141 rtx_code_label *ehr_label;
143 rtx sjlj_fc;
144 rtx_insn *sjlj_exit_after;
146 vec<uchar, va_gc> *action_record_data;
148 vec<call_site_record, va_gc> *call_site_record_v[2];
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)
158 struct gimple_df;
159 struct temp_slot;
160 typedef struct temp_slot *temp_slot_p;
161 struct call_site_record_d;
162 struct dw_fde_node;
164 class ipa_opt_pass_d;
165 typedef ipa_opt_pass_d *ipa_opt_pass;
168 struct GTY(()) varasm_status {
169 /* If we're using a per-function constant pool, this is it. */
170 struct rtx_constant_pool *pool;
172 /* Number of tree-constants deferred during the expansion of this
173 function. */
174 unsigned int deferred_constants;
177 /* Information mainlined about RTL representation of incoming arguments. */
178 struct GTY(()) incoming_args {
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;
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;
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;
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;
198 /* Quantities of various kinds of registers
199 used for the current function's args. */
200 CUMULATIVE_ARGS info;
202 /* The arg pointer hard register, or the pseudo into which it was copied. */
203 rtx internal_arg_pointer;
206 /* Data for function partitioning. */
207 struct GTY(()) function_subsections {
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. */
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;
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. */
221 struct GTY(()) frame_space
223 struct frame_space *next;
225 HOST_WIDE_INT start;
226 HOST_WIDE_INT length;
229 /* Datastructures maintained for currently processed function in RTL form. */
230 struct GTY(()) rtl_data {
231 struct expr_status expr;
232 struct emit_status emit;
233 struct varasm_status varasm;
234 struct incoming_args args;
235 struct function_subsections subsections;
236 struct rtl_eh eh;
238 /* For function.c */
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;
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 /* If nonxero, an RTL expression for the lcoation at which the current
250 function returns bounds for its result. */
251 rtx return_bnd;
253 /* Vector of initial-value pairs. Each pair consists of a pseudo
254 register of approprite mode that stores the initial value a hard
255 register REGNO, and that hard register itself. */
256 /* ??? This could be a VEC but there is currently no way to define an
257 opaque VEC type. */
258 struct initial_value_struct *hard_reg_initial_vals;
260 /* A variable living at the top of the frame that holds a known value.
261 Used for detecting stack clobbers. */
262 tree stack_protect_guard;
264 /* List (chain of INSN_LIST) of labels heading the current handlers for
265 nonlocal gotos. */
266 rtx_insn_list *x_nonlocal_goto_handler_labels;
268 /* Label that will go on function epilogue.
269 Jumping to this label serves as a "return" instruction
270 on machines which require execution of the epilogue on all returns. */
271 rtx_code_label *x_return_label;
273 /* Label that will go on the end of function epilogue.
274 Jumping to this label serves as a "naked return" instruction
275 on machines which require execution of the epilogue on all returns. */
276 rtx_code_label *x_naked_return_label;
278 /* List (chain of EXPR_LISTs) of all stack slots in this function.
279 Made for the sake of unshare_all_rtl. */
280 rtx_expr_list *x_stack_slot_list;
282 /* List of empty areas in the stack frame. */
283 struct frame_space *frame_space_list;
285 /* Place after which to insert the tail_recursion_label if we need one. */
286 rtx_note *x_stack_check_probe_note;
288 /* Location at which to save the argument pointer if it will need to be
289 referenced. There are two cases where this is done: if nonlocal gotos
290 exist, or if vars stored at an offset from the argument pointer will be
291 needed by inner routines. */
292 rtx x_arg_pointer_save_area;
294 /* Dynamic Realign Argument Pointer used for realigning stack. */
295 rtx drap_reg;
297 /* Offset to end of allocated area of stack frame.
298 If stack grows down, this is the address of the last stack slot allocated.
299 If stack grows up, this is the address for the next slot. */
300 HOST_WIDE_INT x_frame_offset;
302 /* Insn after which register parms and SAVE_EXPRs are born, if nonopt. */
303 rtx_insn *x_parm_birth_insn;
305 /* List of all used temporaries allocated, by level. */
306 vec<temp_slot_p, va_gc> *x_used_temp_slots;
308 /* List of available temp slots. */
309 struct temp_slot *x_avail_temp_slots;
311 /* Current nesting level for temporaries. */
312 int x_temp_slot_level;
314 /* The largest alignment needed on the stack, including requirement
315 for outgoing stack alignment. */
316 unsigned int stack_alignment_needed;
318 /* Preferred alignment of the end of stack frame, which is preferred
319 to call other functions. */
320 unsigned int preferred_stack_boundary;
322 /* The minimum alignment of parameter stack. */
323 unsigned int parm_stack_boundary;
325 /* The largest alignment of slot allocated on the stack. */
326 unsigned int max_used_stack_slot_alignment;
328 /* The stack alignment estimated before reload, with consideration of
329 following factors:
330 1. Alignment of local stack variables (max_used_stack_slot_alignment)
331 2. Alignment requirement to call other functions
332 (preferred_stack_boundary)
333 3. Alignment of non-local stack variables but might be spilled in
334 local stack. */
335 unsigned int stack_alignment_estimated;
337 /* For reorg. */
339 /* Nonzero if function being compiled called builtin_return_addr or
340 builtin_frame_address with nonzero count. */
341 bool accesses_prior_frames;
343 /* Nonzero if the function calls __builtin_eh_return. */
344 bool calls_eh_return;
346 /* Nonzero if function saves all registers, e.g. if it has a nonlocal
347 label that can reach the exit block via non-exceptional paths. */
348 bool saves_all_registers;
350 /* Nonzero if function being compiled has nonlocal gotos to parent
351 function. */
352 bool has_nonlocal_goto;
354 /* Nonzero if function being compiled has an asm statement. */
355 bool has_asm_statement;
357 /* This bit is used by the exception handling logic. It is set if all
358 calls (if any) are sibling calls. Such functions do not have to
359 have EH tables generated, as they cannot throw. A call to such a
360 function, however, should be treated as throwing if any of its callees
361 can throw. */
362 bool all_throwers_are_sibcalls;
364 /* Nonzero if stack limit checking should be enabled in the current
365 function. */
366 bool limit_stack;
368 /* Nonzero if profiling code should be generated. */
369 bool profile;
371 /* Nonzero if the current function uses the constant pool. */
372 bool uses_const_pool;
374 /* Nonzero if the current function uses pic_offset_table_rtx. */
375 bool uses_pic_offset_table;
377 /* Nonzero if the current function needs an lsda for exception handling. */
378 bool uses_eh_lsda;
380 /* Set when the tail call has been produced. */
381 bool tail_call_emit;
383 /* Nonzero if code to initialize arg_pointer_save_area has been emitted. */
384 bool arg_pointer_save_area_init;
386 /* Nonzero if current function must be given a frame pointer.
387 Set in reload1.c or lra-eliminations.c if anything is allocated
388 on the stack there. */
389 bool frame_pointer_needed;
391 /* When set, expand should optimize for speed. */
392 bool maybe_hot_insn_p;
394 /* Nonzero if function stack realignment is needed. This flag may be
395 set twice: before and after reload. It is set before reload wrt
396 stack alignment estimation before reload. It will be changed after
397 reload if by then criteria of stack realignment is different.
398 The value set after reload is the accurate one and is finalized. */
399 bool stack_realign_needed;
401 /* Nonzero if function stack realignment is tried. This flag is set
402 only once before reload. It affects register elimination. This
403 is used to generate DWARF debug info for stack variables. */
404 bool stack_realign_tried;
406 /* Nonzero if function being compiled needs dynamic realigned
407 argument pointer (drap) if stack needs realigning. */
408 bool need_drap;
410 /* Nonzero if function stack realignment estimation is done, namely
411 stack_realign_needed flag has been set before reload wrt estimated
412 stack alignment info. */
413 bool stack_realign_processed;
415 /* Nonzero if function stack realignment has been finalized, namely
416 stack_realign_needed flag has been set and finalized after reload. */
417 bool stack_realign_finalized;
419 /* True if dbr_schedule has already been called for this function. */
420 bool dbr_scheduled_p;
422 /* True if current function can not throw. Unlike
423 TREE_NOTHROW (current_function_decl) it is set even for overwritable
424 function where currently compiled version of it is nothrow. */
425 bool nothrow;
427 /* True if we performed shrink-wrapping for the current function. */
428 bool shrink_wrapped;
430 /* Nonzero if function being compiled doesn't modify the stack pointer
431 (ignoring the prologue and epilogue). This is only valid after
432 pass_stack_ptr_mod has run. */
433 bool sp_is_unchanging;
435 /* Nonzero if function being compiled doesn't contain any calls
436 (ignoring the prologue and epilogue). This is set prior to
437 local register allocation and is valid for the remaining
438 compiler passes. */
439 bool is_leaf;
441 /* Nonzero if the function being compiled is a leaf function which only
442 uses leaf registers. This is valid after reload (specifically after
443 sched2) and is useful only if the port defines LEAF_REGISTERS. */
444 bool uses_only_leaf_regs;
446 /* Nonzero if the function being compiled has undergone hot/cold partitioning
447 (under flag_reorder_blocks_and_partition) and has at least one cold
448 block. */
449 bool has_bb_partition;
451 /* Nonzero if the function being compiled has completed the bb reordering
452 pass. */
453 bool bb_reorder_complete;
455 /* Like regs_ever_live, but 1 if a reg is set or clobbered from an
456 asm. Unlike regs_ever_live, elements of this array corresponding
457 to eliminable regs (like the frame pointer) are set if an asm
458 sets them. */
459 HARD_REG_SET asm_clobbers;
462 #define return_label (crtl->x_return_label)
463 #define naked_return_label (crtl->x_naked_return_label)
464 #define stack_slot_list (crtl->x_stack_slot_list)
465 #define parm_birth_insn (crtl->x_parm_birth_insn)
466 #define frame_offset (crtl->x_frame_offset)
467 #define stack_check_probe_note (crtl->x_stack_check_probe_note)
468 #define arg_pointer_save_area (crtl->x_arg_pointer_save_area)
469 #define used_temp_slots (crtl->x_used_temp_slots)
470 #define avail_temp_slots (crtl->x_avail_temp_slots)
471 #define temp_slot_level (crtl->x_temp_slot_level)
472 #define nonlocal_goto_handler_labels (crtl->x_nonlocal_goto_handler_labels)
473 #define frame_pointer_needed (crtl->frame_pointer_needed)
474 #define stack_realign_fp (crtl->stack_realign_needed && !crtl->need_drap)
475 #define stack_realign_drap (crtl->stack_realign_needed && crtl->need_drap)
477 extern GTY(()) struct rtl_data x_rtl;
479 /* Accessor to RTL datastructures. We keep them statically allocated now since
480 we never keep multiple functions. For threaded compiler we might however
481 want to do differently. */
482 #define crtl (&x_rtl)
484 struct GTY(()) stack_usage
486 /* # of bytes of static stack space allocated by the function. */
487 HOST_WIDE_INT static_stack_size;
489 /* # of bytes of dynamic stack space allocated by the function. This is
490 meaningful only if has_unbounded_dynamic_stack_size is zero. */
491 HOST_WIDE_INT dynamic_stack_size;
493 /* # of bytes of space pushed onto the stack after the prologue. If
494 !ACCUMULATE_OUTGOING_ARGS, it contains the outgoing arguments. */
495 int pushed_stack_size;
497 /* Nonzero if the amount of stack space allocated dynamically cannot
498 be bounded at compile-time. */
499 unsigned int has_unbounded_dynamic_stack_size : 1;
502 #define current_function_static_stack_size (cfun->su->static_stack_size)
503 #define current_function_dynamic_stack_size (cfun->su->dynamic_stack_size)
504 #define current_function_pushed_stack_size (cfun->su->pushed_stack_size)
505 #define current_function_has_unbounded_dynamic_stack_size \
506 (cfun->su->has_unbounded_dynamic_stack_size)
507 #define current_function_allocates_dynamic_stack_space \
508 (current_function_dynamic_stack_size != 0 \
509 || current_function_has_unbounded_dynamic_stack_size)
511 /* This structure can save all the important global and static variables
512 describing the status of the current function. */
514 struct GTY(()) function {
515 struct eh_status *eh;
517 /* The control flow graph for this function. */
518 struct control_flow_graph *cfg;
520 /* GIMPLE body for this function. */
521 gimple_seq gimple_body;
523 /* SSA and dataflow information. */
524 struct gimple_df *gimple_df;
526 /* The loops in this function. */
527 struct loops *x_current_loops;
529 /* The stack usage of this function. */
530 struct stack_usage *su;
532 /* Value histograms attached to particular statements. */
533 htab_t GTY((skip)) value_histograms;
535 /* For function.c. */
537 /* Points to the FUNCTION_DECL of this function. */
538 tree decl;
540 /* A PARM_DECL that should contain the static chain for this function.
541 It will be initialized at the beginning of the function. */
542 tree static_chain_decl;
544 /* An expression that contains the non-local goto save area. The first
545 word is the saved frame pointer and the second is the saved stack
546 pointer. */
547 tree nonlocal_goto_save_area;
549 /* Vector of function local variables, functions, types and constants. */
550 vec<tree, va_gc> *local_decls;
552 /* In a Cilk function, the VAR_DECL for the frame descriptor. */
553 tree cilk_frame_decl;
555 /* For md files. */
557 /* tm.h can use this to store whatever it likes. */
558 struct machine_function * GTY ((maybe_undef)) machine;
560 /* Language-specific code can use this to store whatever it likes. */
561 struct language_function * language;
563 /* Used types hash table. */
564 hash_set<tree> *GTY (()) used_types_hash;
566 /* Dwarf2 Frame Description Entry, containing the Call Frame Instructions
567 used for unwinding. Only set when either dwarf2 unwinding or dwarf2
568 debugging is enabled. */
569 struct dw_fde_node *fde;
571 /* Last statement uid. */
572 int last_stmt_uid;
574 /* Function sequence number for profiling, debugging, etc. */
575 int funcdef_no;
577 /* Line number of the start of the function for debugging purposes. */
578 location_t function_start_locus;
580 /* Line number of the end of the function. */
581 location_t function_end_locus;
583 /* Properties used by the pass manager. */
584 unsigned int curr_properties;
585 unsigned int last_verified;
587 /* Non-null if the function does something that would prevent it from
588 being copied; this applies to both versioning and inlining. Set to
589 a string describing the reason for failure. */
590 const char * GTY((skip)) cannot_be_copied_reason;
592 /* Collected bit flags. */
594 /* Number of units of general registers that need saving in stdarg
595 function. What unit is depends on the backend, either it is number
596 of bytes, or it can be number of registers. */
597 unsigned int va_list_gpr_size : 8;
599 /* Number of units of floating point registers that need saving in stdarg
600 function. */
601 unsigned int va_list_fpr_size : 8;
603 /* Nonzero if function being compiled can call setjmp. */
604 unsigned int calls_setjmp : 1;
606 /* Nonzero if function being compiled can call alloca,
607 either as a subroutine or builtin. */
608 unsigned int calls_alloca : 1;
610 /* This will indicate whether a function is a cilk function */
611 unsigned int is_cilk_function : 1;
613 /* Nonzero if this is a Cilk function that spawns. */
614 unsigned int calls_cilk_spawn : 1;
616 /* Nonzero if function being compiled receives nonlocal gotos
617 from nested functions. */
618 unsigned int has_nonlocal_label : 1;
620 /* Nonzero if we've set cannot_be_copied_reason. I.e. if
621 (cannot_be_copied_set && !cannot_be_copied_reason), the function
622 can in fact be copied. */
623 unsigned int cannot_be_copied_set : 1;
625 /* Nonzero if current function uses stdarg.h or equivalent. */
626 unsigned int stdarg : 1;
628 unsigned int after_inlining : 1;
629 unsigned int always_inline_functions_inlined : 1;
631 /* Nonzero if function being compiled can throw synchronous non-call
632 exceptions. */
633 unsigned int can_throw_non_call_exceptions : 1;
635 /* Nonzero if instructions that may throw exceptions but don't otherwise
636 contribute to the execution of the program can be deleted. */
637 unsigned int can_delete_dead_exceptions : 1;
639 /* Fields below this point are not set for abstract functions; see
640 allocate_struct_function. */
642 /* Nonzero if function being compiled needs to be given an address
643 where the value should be stored. */
644 unsigned int returns_struct : 1;
646 /* Nonzero if function being compiled needs to
647 return the address of where it has put a structure value. */
648 unsigned int returns_pcc_struct : 1;
650 /* Nonzero if this function has local DECL_HARD_REGISTER variables.
651 In this case code motion has to be done more carefully. */
652 unsigned int has_local_explicit_reg_vars : 1;
654 /* Nonzero if the current function is a thunk, i.e., a lightweight
655 function implemented by the output_mi_thunk hook) that just
656 adjusts one of its arguments and forwards to another
657 function. */
658 unsigned int is_thunk : 1;
660 /* Nonzero if the current function contains any loops with
661 loop->force_vectorize set. */
662 unsigned int has_force_vectorize_loops : 1;
664 /* Nonzero if the current function contains any loops with
665 nonzero value in loop->simduid. */
666 unsigned int has_simduid_loops : 1;
668 /* Set when the tail call has been identified. */
669 unsigned int tail_call_marked : 1;
672 /* Add the decl D to the local_decls list of FUN. */
674 void add_local_decl (struct function *fun, tree d);
676 #define FOR_EACH_LOCAL_DECL(FUN, I, D) \
677 FOR_EACH_VEC_SAFE_ELT_REVERSE ((FUN)->local_decls, I, D)
679 /* If va_list_[gf]pr_size is set to this, it means we don't know how
680 many units need to be saved. */
681 #define VA_LIST_MAX_GPR_SIZE 255
682 #define VA_LIST_MAX_FPR_SIZE 255
684 /* The function currently being compiled. */
685 extern GTY(()) struct function *cfun;
687 /* In order to ensure that cfun is not set directly, we redefine it so
688 that it is not an lvalue. Rather than assign to cfun, use
689 push_cfun or set_cfun. */
690 #define cfun (cfun + 0)
692 /* Nonzero if we've already converted virtual regs to hard regs. */
693 extern int virtuals_instantiated;
695 /* Nonzero if at least one trampoline has been created. */
696 extern int trampolines_created;
698 struct GTY((for_user)) types_used_by_vars_entry {
699 tree type;
700 tree var_decl;
703 struct used_type_hasher : ggc_hasher<types_used_by_vars_entry *>
705 static hashval_t hash (types_used_by_vars_entry *);
706 static bool equal (types_used_by_vars_entry *, types_used_by_vars_entry *);
709 /* Hash table making the relationship between a global variable
710 and the types it references in its initializer. The key of the
711 entry is a referenced type, and the value is the DECL of the global
712 variable. types_use_by_vars_do_hash and types_used_by_vars_eq below are
713 the hash and equality functions to use for this hash table. */
714 extern GTY(()) hash_table<used_type_hasher> *types_used_by_vars_hash;
716 void types_used_by_var_decl_insert (tree type, tree var_decl);
718 /* During parsing of a global variable, this vector contains the types
719 referenced by the global variable. */
720 extern GTY(()) vec<tree, va_gc> *types_used_by_cur_var_decl;
723 /* Return the loop tree of FN. */
725 inline struct loops *
726 loops_for_fn (struct function *fn)
728 return fn->x_current_loops;
731 /* Set the loop tree of FN to LOOPS. */
733 inline void
734 set_loops_for_fn (struct function *fn, struct loops *loops)
736 gcc_checking_assert (fn->x_current_loops == NULL || loops == NULL);
737 fn->x_current_loops = loops;
740 /* For backward compatibility... eventually these should all go away. */
741 #define current_function_funcdef_no (cfun->funcdef_no)
743 #define current_loops (cfun->x_current_loops)
744 #define dom_computed (cfun->cfg->x_dom_computed)
745 #define n_bbs_in_dom_tree (cfun->cfg->x_n_bbs_in_dom_tree)
746 #define VALUE_HISTOGRAMS(fun) (fun)->value_histograms
748 /* A pointer to a function to create target specific, per-function
749 data structures. */
750 extern struct machine_function * (*init_machine_status) (void);
752 enum direction {none, upward, downward};
754 /* Structure to record the size of a sequence of arguments
755 as the sum of a tree-expression and a constant. This structure is
756 also used to store offsets from the stack, which might be negative,
757 so the variable part must be ssizetype, not sizetype. */
759 struct args_size
761 HOST_WIDE_INT constant;
762 tree var;
765 /* Package up various arg related fields of struct args for
766 locate_and_pad_parm. */
767 struct locate_and_pad_arg_data
769 /* Size of this argument on the stack, rounded up for any padding it
770 gets. If REG_PARM_STACK_SPACE is defined, then register parms are
771 counted here, otherwise they aren't. */
772 struct args_size size;
773 /* Offset of this argument from beginning of stack-args. */
774 struct args_size offset;
775 /* Offset to the start of the stack slot. Different from OFFSET
776 if this arg pads downward. */
777 struct args_size slot_offset;
778 /* The amount that the stack pointer needs to be adjusted to
779 force alignment for the next argument. */
780 struct args_size alignment_pad;
781 /* Which way we should pad this arg. */
782 enum direction where_pad;
783 /* slot_offset is at least this aligned. */
784 unsigned int boundary;
787 /* Add the value of the tree INC to the `struct args_size' TO. */
789 #define ADD_PARM_SIZE(TO, INC) \
790 do { \
791 tree inc = (INC); \
792 if (tree_fits_shwi_p (inc)) \
793 (TO).constant += tree_to_shwi (inc); \
794 else if ((TO).var == 0) \
795 (TO).var = fold_convert (ssizetype, inc); \
796 else \
797 (TO).var = size_binop (PLUS_EXPR, (TO).var, \
798 fold_convert (ssizetype, inc)); \
799 } while (0)
801 #define SUB_PARM_SIZE(TO, DEC) \
802 do { \
803 tree dec = (DEC); \
804 if (tree_fits_shwi_p (dec)) \
805 (TO).constant -= tree_to_shwi (dec); \
806 else if ((TO).var == 0) \
807 (TO).var = size_binop (MINUS_EXPR, ssize_int (0), \
808 fold_convert (ssizetype, dec)); \
809 else \
810 (TO).var = size_binop (MINUS_EXPR, (TO).var, \
811 fold_convert (ssizetype, dec)); \
812 } while (0)
814 /* Convert the implicit sum in a `struct args_size' into a tree
815 of type ssizetype. */
816 #define ARGS_SIZE_TREE(SIZE) \
817 ((SIZE).var == 0 ? ssize_int ((SIZE).constant) \
818 : size_binop (PLUS_EXPR, fold_convert (ssizetype, (SIZE).var), \
819 ssize_int ((SIZE).constant)))
821 /* Convert the implicit sum in a `struct args_size' into an rtx. */
822 #define ARGS_SIZE_RTX(SIZE) \
823 ((SIZE).var == 0 ? GEN_INT ((SIZE).constant) \
824 : expand_normal (ARGS_SIZE_TREE (SIZE)))
826 #define ASLK_REDUCE_ALIGN 1
827 #define ASLK_RECORD_PAD 2
831 extern void push_function_context (void);
832 extern void pop_function_context (void);
834 /* Save and restore status information for a nested function. */
835 extern void free_after_parsing (struct function *);
836 extern void free_after_compilation (struct function *);
838 /* Return size needed for stack frame based on slots so far allocated.
839 This size counts from zero. It is not rounded to STACK_BOUNDARY;
840 the caller may have to do that. */
841 extern HOST_WIDE_INT get_frame_size (void);
843 /* Issue an error message and return TRUE if frame OFFSET overflows in
844 the signed target pointer arithmetics for function FUNC. Otherwise
845 return FALSE. */
846 extern bool frame_offset_overflow (HOST_WIDE_INT, tree);
848 extern rtx assign_stack_local_1 (machine_mode, HOST_WIDE_INT, int, int);
849 extern rtx assign_stack_local (machine_mode, HOST_WIDE_INT, int);
850 extern rtx assign_stack_temp_for_type (machine_mode, HOST_WIDE_INT, tree);
851 extern rtx assign_stack_temp (machine_mode, HOST_WIDE_INT);
852 extern rtx assign_temp (tree, int, int);
853 extern void update_temp_slot_address (rtx, rtx);
854 extern void preserve_temp_slots (rtx);
855 extern void free_temp_slots (void);
856 extern void push_temp_slots (void);
857 extern void pop_temp_slots (void);
858 extern void init_temp_slots (void);
859 extern rtx get_hard_reg_initial_reg (rtx);
860 extern rtx get_hard_reg_initial_val (machine_mode, unsigned int);
861 extern rtx has_hard_reg_initial_val (machine_mode, unsigned int);
863 /* Called from gimple_expand_cfg. */
864 extern unsigned int emit_initial_value_sets (void);
866 extern bool initial_value_entry (int i, rtx *, rtx *);
867 extern void instantiate_decl_rtl (rtx x);
868 extern int aggregate_value_p (const_tree, const_tree);
869 extern bool use_register_for_decl (const_tree);
870 extern bool pass_by_reference (CUMULATIVE_ARGS *, machine_mode,
871 tree, bool);
872 extern bool reference_callee_copied (CUMULATIVE_ARGS *, machine_mode,
873 tree, bool);
874 extern gimple_seq gimplify_parameters (void);
875 extern void locate_and_pad_parm (machine_mode, tree, int, int, int,
876 tree, struct args_size *,
877 struct locate_and_pad_arg_data *);
878 extern void generate_setjmp_warnings (void);
880 /* Identify BLOCKs referenced by more than one NOTE_INSN_BLOCK_{BEG,END},
881 and create duplicate blocks. */
882 extern void reorder_blocks (void);
883 extern void clear_block_marks (tree);
884 extern tree blocks_nreverse (tree);
885 extern tree block_chainon (tree, tree);
887 /* Set BLOCK_NUMBER for all the blocks in FN. */
888 extern void number_blocks (tree);
890 /* cfun shouldn't be set directly; use one of these functions instead. */
891 extern void set_cfun (struct function *new_cfun);
892 extern void push_cfun (struct function *new_cfun);
893 extern void pop_cfun (void);
895 extern int get_next_funcdef_no (void);
896 extern int get_last_funcdef_no (void);
897 extern void allocate_struct_function (tree, bool);
898 extern void push_struct_function (tree fndecl);
899 extern void init_dummy_function_start (void);
900 extern void init_function_start (tree);
901 extern void stack_protect_epilogue (void);
902 extern void expand_function_start (tree);
903 extern void expand_dummy_function_end (void);
905 extern void thread_prologue_and_epilogue_insns (void);
907 #ifdef RTX_CODE
908 extern void diddle_return_value (void (*)(rtx, void*), void*);
909 extern void clobber_return_register (void);
910 #endif
912 extern void do_warn_unused_parameter (tree);
913 extern void expand_function_end (void);
914 extern rtx get_arg_pointer_save_area (void);
915 extern void maybe_copy_prologue_epilogue_insn (rtx, rtx);
916 extern int prologue_epilogue_contains (const_rtx);
917 extern void emit_return_into_block (bool simple_p, basic_block bb);
918 extern void set_return_jump_label (rtx);
919 extern bool active_insn_between (rtx_insn *head, rtx_insn *tail);
920 extern vec<edge> convert_jumps_to_returns (basic_block last_bb, bool simple_p,
921 vec<edge> unconverted);
922 extern basic_block emit_return_for_exit (edge exit_fallthru_edge,
923 bool simple_p);
924 extern void reposition_prologue_and_epilogue_notes (void);
926 /* Returns the name of the current function. */
927 extern const char *fndecl_name (tree);
928 extern const char *function_name (struct function *);
929 extern const char *current_function_name (void);
931 extern void used_types_insert (tree);
933 #endif /* GCC_FUNCTION_H */