function.h revision 90075
118334Speter/* Structure for saving state for a nested function.
290075Sobrien   Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
390075Sobrien   1999, 2000 Free Software Foundation, Inc.
418334Speter
590075SobrienThis file is part of GCC.
618334Speter
790075SobrienGCC is free software; you can redistribute it and/or modify it under
890075Sobrienthe terms of the GNU General Public License as published by the Free
990075SobrienSoftware Foundation; either version 2, or (at your option) any later
1090075Sobrienversion.
1118334Speter
1290075SobrienGCC is distributed in the hope that it will be useful, but WITHOUT ANY
1390075SobrienWARRANTY; without even the implied warranty of MERCHANTABILITY or
1490075SobrienFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1590075Sobrienfor more details.
1618334Speter
1718334SpeterYou should have received a copy of the GNU General Public License
1890075Sobrienalong with GCC; see the file COPYING.  If not, write to the Free
1990075SobrienSoftware Foundation, 59 Temple Place - Suite 330, Boston, MA
2090075Sobrien02111-1307, USA.  */
2118334Speter
2218334Speterstruct var_refs_queue
2318334Speter{
2418334Speter  rtx modified;
2518334Speter  enum machine_mode promoted_mode;
2618334Speter  int unsignedp;
2718334Speter  struct var_refs_queue *next;
2818334Speter};
2918334Speter
3018334Speter/* Stack of pending (incomplete) sequences saved by `start_sequence'.
3118334Speter   Each element describes one pending sequence.
3218334Speter   The main insn-chain is saved in the last element of the chain,
3318334Speter   unless the chain is empty.  */
3418334Speter
3518334Speterstruct sequence_stack
3618334Speter{
3718334Speter  /* First and last insns in the chain of the saved sequence.  */
3818334Speter  rtx first, last;
3918334Speter  tree sequence_rtl_expr;
4018334Speter  struct sequence_stack *next;
4118334Speter};
4218334Speter
4318334Speterextern struct sequence_stack *sequence_stack;
4418334Speter
4518334Speter/* Stack of single obstacks.  */
4618334Speter
4718334Speterstruct simple_obstack_stack
4818334Speter{
4918334Speter  struct obstack *obstack;
5018334Speter  struct simple_obstack_stack *next;
5118334Speter};
5218334Speter
5390075Sobrienstruct emit_status
5490075Sobrien{
5590075Sobrien  /* This is reset to LAST_VIRTUAL_REGISTER + 1 at the start of each function.
5690075Sobrien     After rtl generation, it is 1 plus the largest register number used.  */
5790075Sobrien  int x_reg_rtx_no;
5890075Sobrien
5990075Sobrien  /* Lowest label number in current function.  */
6090075Sobrien  int x_first_label_num;
6190075Sobrien
6290075Sobrien  /* The ends of the doubly-linked chain of rtl for the current function.
6390075Sobrien     Both are reset to null at the start of rtl generation for the function.
6490075Sobrien
6590075Sobrien     start_sequence saves both of these on `sequence_stack' along with
6690075Sobrien     `sequence_rtl_expr' and then starts a new, nested sequence of insns.  */
6790075Sobrien  rtx x_first_insn;
6890075Sobrien  rtx x_last_insn;
6990075Sobrien
7090075Sobrien  /* RTL_EXPR within which the current sequence will be placed.  Use to
7190075Sobrien     prevent reuse of any temporaries within the sequence until after the
7290075Sobrien     RTL_EXPR is emitted.  */
7390075Sobrien  tree sequence_rtl_expr;
7490075Sobrien
7590075Sobrien  /* Stack of pending (incomplete) sequences saved by `start_sequence'.
7690075Sobrien     Each element describes one pending sequence.
7790075Sobrien     The main insn-chain is saved in the last element of the chain,
7890075Sobrien     unless the chain is empty.  */
7990075Sobrien  struct sequence_stack *sequence_stack;
8090075Sobrien
8190075Sobrien  /* INSN_UID for next insn emitted.
8290075Sobrien     Reset to 1 for each function compiled.  */
8390075Sobrien  int x_cur_insn_uid;
8490075Sobrien
8590075Sobrien  /* Line number and source file of the last line-number NOTE emitted.
8690075Sobrien     This is used to avoid generating duplicates.  */
8790075Sobrien  int x_last_linenum;
8890075Sobrien  const char *x_last_filename;
8990075Sobrien
9090075Sobrien  /* The length of the regno_pointer_align, regno_decl, and x_regno_reg_rtx
9190075Sobrien     vectors.  Since these vectors are needed during the expansion phase when
9290075Sobrien     the total number of registers in the function is not yet known, the
9390075Sobrien     vectors are copied and made bigger when necessary.  */
9490075Sobrien  int regno_pointer_align_length;
9590075Sobrien
9690075Sobrien  /* Indexed by pseudo register number, if nonzero gives the known alignment
9790075Sobrien     for that pseudo (if REG_POINTER is set in x_regno_reg_rtx).
9890075Sobrien     Allocated in parallel with x_regno_reg_rtx.  */
9990075Sobrien  unsigned char *regno_pointer_align;
10090075Sobrien
10190075Sobrien  /* Indexed by pseudo register number, if nonzero gives the decl
10290075Sobrien     corresponding to that register.  */
10390075Sobrien  tree *regno_decl;
10490075Sobrien
10590075Sobrien  /* Indexed by pseudo register number, gives the rtx for that pseudo.
10690075Sobrien     Allocated in parallel with regno_pointer_align.  */
10790075Sobrien  rtx *x_regno_reg_rtx;
10890075Sobrien};
10990075Sobrien
11090075Sobrien/* For backward compatibility... eventually these should all go away.  */
11190075Sobrien#define reg_rtx_no (cfun->emit->x_reg_rtx_no)
11290075Sobrien#define seq_rtl_expr (cfun->emit->sequence_rtl_expr)
11390075Sobrien#define regno_reg_rtx (cfun->emit->x_regno_reg_rtx)
11490075Sobrien#define seq_stack (cfun->emit->sequence_stack)
11590075Sobrien
11690075Sobrien#define REGNO_POINTER_ALIGN(REGNO) (cfun->emit->regno_pointer_align[REGNO])
11790075Sobrien#define REGNO_DECL(REGNO) (cfun->emit->regno_decl[REGNO])
11890075Sobrien
11990075Sobrienstruct expr_status
12090075Sobrien{
12190075Sobrien  /* Number of units that we should eventually pop off the stack.
12290075Sobrien     These are the arguments to function calls that have already returned.  */
12390075Sobrien  int x_pending_stack_adjust;
12490075Sobrien
12590075Sobrien  /* Under some ABIs, it is the caller's responsibility to pop arguments
12690075Sobrien     pushed for function calls.  A naive implementation would simply pop
12790075Sobrien     the arguments immediately after each call.  However, if several
12890075Sobrien     function calls are made in a row, it is typically cheaper to pop
12990075Sobrien     all the arguments after all of the calls are complete since a
13090075Sobrien     single pop instruction can be used.  Therefore, GCC attempts to
13190075Sobrien     defer popping the arguments until absolutely necessary.  (For
13290075Sobrien     example, at the end of a conditional, the arguments must be popped,
13390075Sobrien     since code outside the conditional won't know whether or not the
13490075Sobrien     arguments need to be popped.)
13590075Sobrien
13690075Sobrien     When INHIBIT_DEFER_POP is non-zero, however, the compiler does not
13790075Sobrien     attempt to defer pops.  Instead, the stack is popped immediately
13890075Sobrien     after each call.  Rather then setting this variable directly, use
13990075Sobrien     NO_DEFER_POP and OK_DEFER_POP.  */
14090075Sobrien  int x_inhibit_defer_pop;
14190075Sobrien
14290075Sobrien  /* If PREFERRED_STACK_BOUNDARY and PUSH_ROUNDING are defined, the stack
14390075Sobrien     boundary can be momentairly unaligned while pushing the arguments.
14490075Sobrien     Record the delta since last aligned boundary here in order to get
14590075Sobrien     stack alignment in the nested function calls working right.  */
14690075Sobrien  int x_stack_pointer_delta;
14790075Sobrien
14890075Sobrien  /* Nonzero means __builtin_saveregs has already been done in this function.
14990075Sobrien     The value is the pseudoreg containing the value __builtin_saveregs
15090075Sobrien     returned.  */
15190075Sobrien  rtx x_saveregs_value;
15290075Sobrien
15390075Sobrien  /* Similarly for __builtin_apply_args.  */
15490075Sobrien  rtx x_apply_args_value;
15590075Sobrien
15690075Sobrien  /* List of labels that must never be deleted.  */
15790075Sobrien  rtx x_forced_labels;
15890075Sobrien
15990075Sobrien  /* Postincrements that still need to be expanded.  */
16090075Sobrien  rtx x_pending_chain;
16190075Sobrien};
16290075Sobrien
16390075Sobrien#define pending_stack_adjust (cfun->expr->x_pending_stack_adjust)
16490075Sobrien#define inhibit_defer_pop (cfun->expr->x_inhibit_defer_pop)
16590075Sobrien#define saveregs_value (cfun->expr->x_saveregs_value)
16690075Sobrien#define apply_args_value (cfun->expr->x_apply_args_value)
16790075Sobrien#define forced_labels (cfun->expr->x_forced_labels)
16890075Sobrien#define pending_chain (cfun->expr->x_pending_chain)
16990075Sobrien#define stack_pointer_delta (cfun->expr->x_stack_pointer_delta)
17090075Sobrien
17118334Speter/* This structure can save all the important global and static variables
17218334Speter   describing the status of the current function.  */
17318334Speter
17418334Speterstruct function
17518334Speter{
17690075Sobrien  struct eh_status *eh;
17790075Sobrien  struct stmt_status *stmt;
17890075Sobrien  struct expr_status *expr;
17990075Sobrien  struct emit_status *emit;
18090075Sobrien  struct varasm_status *varasm;
18118334Speter
18218334Speter  /* For function.c.  */
18390075Sobrien
18490075Sobrien  /* Name of this function.  */
18590075Sobrien  const char *name;
18690075Sobrien
18790075Sobrien  /* Points to the FUNCTION_DECL of this function.  */
18818334Speter  tree decl;
18990075Sobrien
19090075Sobrien  /* Function containing this function, if any.  */
19190075Sobrien  struct function *outer;
19290075Sobrien
19390075Sobrien  /* Number of bytes of args popped by function being compiled on its return.
19490075Sobrien     Zero if no bytes are to be popped.
19590075Sobrien     May affect compilation of return insn or of function epilogue.  */
19618334Speter  int pops_args;
19790075Sobrien
19890075Sobrien  /* If function's args have a fixed size, this is that size, in bytes.
19990075Sobrien     Otherwise, it is -1.
20090075Sobrien     May affect compilation of return insn or of function epilogue.  */
20118334Speter  int args_size;
20290075Sobrien
20390075Sobrien  /* # bytes the prologue should push and pretend that the caller pushed them.
20490075Sobrien     The prologue must do this, but only if parms can be passed in
20590075Sobrien     registers.  */
20618334Speter  int pretend_args_size;
20790075Sobrien
20890075Sobrien  /* # of bytes of outgoing arguments.  If ACCUMULATE_OUTGOING_ARGS is
20990075Sobrien     defined, the needed space is pushed by the prologue.  */
21090075Sobrien  int outgoing_args_size;
21190075Sobrien
21290075Sobrien  /* This is the offset from the arg pointer to the place where the first
21390075Sobrien     anonymous arg can be found, if there is one.  */
21418334Speter  rtx arg_offset_rtx;
21590075Sobrien
21690075Sobrien  /* Quantities of various kinds of registers
21790075Sobrien     used for the current function's args.  */
21890075Sobrien  CUMULATIVE_ARGS args_info;
21990075Sobrien
22090075Sobrien  /* If non-zero, an RTL expression for the location at which the current
22190075Sobrien     function returns its result.  If the current function returns its
22290075Sobrien     result in a register, current_function_return_rtx will always be
22390075Sobrien     the hard register containing the result.  */
22418334Speter  rtx return_rtx;
22590075Sobrien
22690075Sobrien  /* The arg pointer hard register, or the pseudo into which it was copied.  */
22718334Speter  rtx internal_arg_pointer;
22818334Speter
22990075Sobrien  /* Language-specific reason why the current function cannot be made
23090075Sobrien     inline.  */
23190075Sobrien  const char *cannot_inline;
23218334Speter
23390075Sobrien  /* Opaque pointer used by get_hard_reg_initial_val and
23490075Sobrien     has_hard_reg_initial_val (see integrate.[hc]).  */
23590075Sobrien  struct initial_value_struct *hard_reg_initial_vals;
23650397Sobrien
23790075Sobrien  /* Number of function calls seen so far in current function.  */
23890075Sobrien  int x_function_call_count;
23918334Speter
24090075Sobrien  /* List (chain of TREE_LIST) of LABEL_DECLs for all nonlocal labels
24190075Sobrien     (labels to which there can be nonlocal gotos from nested functions)
24290075Sobrien     in this function.  */
24390075Sobrien  tree x_nonlocal_labels;
24418334Speter
24590075Sobrien  /* List (chain of EXPR_LIST) of stack slots that hold the current handlers
24690075Sobrien     for nonlocal gotos.  There is one for every nonlocal label in the
24790075Sobrien     function; this list matches the one in nonlocal_labels.
24890075Sobrien     Zero when function does not have nonlocal labels.  */
24990075Sobrien  rtx x_nonlocal_goto_handler_slots;
25018334Speter
25190075Sobrien  /* List (chain of EXPR_LIST) of labels heading the current handlers for
25290075Sobrien     nonlocal gotos.  */
25390075Sobrien  rtx x_nonlocal_goto_handler_labels;
25418334Speter
25590075Sobrien  /* RTX for stack slot that holds the stack pointer value to restore
25690075Sobrien     for a nonlocal goto.
25790075Sobrien     Zero when function does not have nonlocal labels.  */
25890075Sobrien  rtx x_nonlocal_goto_stack_level;
25990075Sobrien
26090075Sobrien  /* Label that will go on parm cleanup code, if any.
26190075Sobrien     Jumping to this label runs cleanup code for parameters, if
26290075Sobrien     such code must be run.  Following this code is the logical return
26390075Sobrien     label.  */
26490075Sobrien  rtx x_cleanup_label;
26590075Sobrien
26690075Sobrien  /* Label that will go on function epilogue.
26790075Sobrien     Jumping to this label serves as a "return" instruction
26890075Sobrien     on machines which require execution of the epilogue on all returns.  */
26990075Sobrien  rtx x_return_label;
27090075Sobrien
27190075Sobrien  /* List (chain of EXPR_LISTs) of pseudo-regs of SAVE_EXPRs.
27290075Sobrien     So we can mark them all live at the end of the function, if nonopt.  */
27390075Sobrien  rtx x_save_expr_regs;
27490075Sobrien
27590075Sobrien  /* List (chain of EXPR_LISTs) of all stack slots in this function.
27690075Sobrien     Made for the sake of unshare_all_rtl.  */
27790075Sobrien  rtx x_stack_slot_list;
27890075Sobrien
27990075Sobrien  /* Chain of all RTL_EXPRs that have insns in them.  */
28090075Sobrien  tree x_rtl_expr_chain;
28190075Sobrien
28290075Sobrien  /* Label to jump back to for tail recursion, or 0 if we have
28390075Sobrien     not yet needed one for this function.  */
28490075Sobrien  rtx x_tail_recursion_label;
28590075Sobrien
28690075Sobrien  /* Place after which to insert the tail_recursion_label if we need one.  */
28790075Sobrien  rtx x_tail_recursion_reentry;
28890075Sobrien
28990075Sobrien  /* Location at which to save the argument pointer if it will need to be
29090075Sobrien     referenced.  There are two cases where this is done: if nonlocal gotos
29190075Sobrien     exist, or if vars stored at an offset from the argument pointer will be
29290075Sobrien     needed by inner routines.  */
29390075Sobrien  rtx x_arg_pointer_save_area;
29490075Sobrien
29590075Sobrien  /* If the function returns non-void, we will emit a clobber of the
29690075Sobrien     return registers just in case the user fell off the end without
29790075Sobrien     returning a proper value.  This is that insn.  */
29890075Sobrien  rtx x_clobber_return_insn;
29990075Sobrien
30090075Sobrien  /* Offset to end of allocated area of stack frame.
30190075Sobrien     If stack grows down, this is the address of the last stack slot allocated.
30290075Sobrien     If stack grows up, this is the address for the next slot.  */
30390075Sobrien  HOST_WIDE_INT x_frame_offset;
30490075Sobrien
30590075Sobrien  /* List (chain of TREE_LISTs) of static chains for containing functions.
30690075Sobrien     Each link has a FUNCTION_DECL in the TREE_PURPOSE and a reg rtx
30790075Sobrien     in an RTL_EXPR in the TREE_VALUE.  */
30890075Sobrien  tree x_context_display;
30990075Sobrien
31090075Sobrien  /* List (chain of TREE_LISTs) of trampolines for nested functions.
31190075Sobrien     The trampoline sets up the static chain and jumps to the function.
31290075Sobrien     We supply the trampoline's address when the function's address is
31390075Sobrien     requested.
31490075Sobrien
31590075Sobrien     Each link has a FUNCTION_DECL in the TREE_PURPOSE and a reg rtx
31690075Sobrien     in an RTL_EXPR in the TREE_VALUE.  */
31790075Sobrien  tree x_trampoline_list;
31890075Sobrien
31990075Sobrien  /* Insn after which register parms and SAVE_EXPRs are born, if nonopt.  */
32090075Sobrien  rtx x_parm_birth_insn;
32190075Sobrien
32290075Sobrien  /* Last insn of those whose job was to put parms into their nominal
32390075Sobrien     homes.  */
32490075Sobrien  rtx x_last_parm_insn;
32590075Sobrien
32690075Sobrien  /* 1 + last pseudo register number possibly used for loading a copy
32790075Sobrien     of a parameter of this function.  */
32890075Sobrien  unsigned int x_max_parm_reg;
32990075Sobrien
33090075Sobrien  /* Vector indexed by REGNO, containing location on stack in which
33190075Sobrien     to put the parm which is nominally in pseudo register REGNO,
33290075Sobrien     if we discover that that parm must go in the stack.  The highest
33390075Sobrien     element in this vector is one less than MAX_PARM_REG, above.  */
33490075Sobrien  rtx *x_parm_reg_stack_loc;
33590075Sobrien
33690075Sobrien  /* List of all temporaries allocated, both available and in use.  */
33790075Sobrien  struct temp_slot *x_temp_slots;
33890075Sobrien
33990075Sobrien  /* Current nesting level for temporaries.  */
34090075Sobrien  int x_temp_slot_level;
34190075Sobrien
34290075Sobrien  /* Current nesting level for variables in a block.  */
34390075Sobrien  int x_var_temp_slot_level;
34490075Sobrien
34590075Sobrien  /* When temporaries are created by TARGET_EXPRs, they are created at
34690075Sobrien     this level of temp_slot_level, so that they can remain allocated
34790075Sobrien     until no longer needed.  CLEANUP_POINT_EXPRs define the lifetime
34890075Sobrien     of TARGET_EXPRs.  */
34990075Sobrien  int x_target_temp_slot_level;
35090075Sobrien
35190075Sobrien  /* This slot is initialized as 0 and is added to
35290075Sobrien     during the nested function.  */
35390075Sobrien  struct var_refs_queue *fixup_var_refs_queue;
35490075Sobrien
35518334Speter  /* For integrate.c.  */
35690075Sobrien  int inlinable;
35790075Sobrien  int no_debugging_symbols;
35890075Sobrien  /* This is in fact an rtvec.  */
35990075Sobrien  void *original_arg_vector;
36090075Sobrien  tree original_decl_initial;
36190075Sobrien  /* Last insn of those whose job was to put parms into their nominal
36290075Sobrien     homes.  */
36390075Sobrien  rtx inl_last_parm_insn;
36490075Sobrien  /* Highest label number in current function.  */
36590075Sobrien  int inl_max_label_num;
36618334Speter
36718334Speter  /* For md files.  */
36890075Sobrien
36918334Speter  /* tm.h can use this to store whatever it likes.  */
37018334Speter  struct machine_function *machine;
37190075Sobrien  /* The largest alignment of slot allocated on the stack.  */
37290075Sobrien  int stack_alignment_needed;
37390075Sobrien  /* Preferred alignment of the end of stack frame.  */
37490075Sobrien  int preferred_stack_boundary;
37518334Speter
37690075Sobrien  /* Language-specific code can use this to store whatever it likes.  */
37790075Sobrien  struct language_function *language;
37890075Sobrien
37918334Speter  /* For reorg.  */
38090075Sobrien
38190075Sobrien  /* If some insns can be deferred to the delay slots of the epilogue, the
38290075Sobrien     delay list for them is recorded here.  */
38318334Speter  rtx epilogue_delay_list;
38418334Speter
38590075Sobrien  /* Collected bit flags.  */
38618334Speter
38790075Sobrien  /* Nonzero if function being compiled needs to be given an address
38890075Sobrien     where the value should be stored.  */
38990075Sobrien  unsigned int returns_struct : 1;
39018334Speter
39190075Sobrien  /* Nonzero if function being compiled needs to
39290075Sobrien     return the address of where it has put a structure value.  */
39390075Sobrien  unsigned int returns_pcc_struct : 1;
39490075Sobrien
39590075Sobrien  /* Nonzero if the current function returns a pointer type.  */
39690075Sobrien  unsigned int returns_pointer : 1;
39752284Sobrien
39890075Sobrien  /* Nonzero if function being compiled needs to be passed a static chain.  */
39990075Sobrien  unsigned int needs_context : 1;
40052284Sobrien
40190075Sobrien  /* Nonzero if function being compiled can call setjmp.  */
40290075Sobrien  unsigned int calls_setjmp : 1;
40352284Sobrien
40490075Sobrien  /* Nonzero if function being compiled can call longjmp.  */
40590075Sobrien  unsigned int calls_longjmp : 1;
40690075Sobrien
40790075Sobrien  /* Nonzero if function being compiled can call alloca,
40890075Sobrien     either as a subroutine or builtin.  */
40990075Sobrien  unsigned int calls_alloca : 1;
41018334Speter
41190075Sobrien  /* Nonzero if the function calls __builtin_eh_return.  */
41290075Sobrien  unsigned int calls_eh_return : 1;
41352284Sobrien
41490075Sobrien  /* Nonzero if function being compiled receives nonlocal gotos
41590075Sobrien     from nested functions.  */
41690075Sobrien  unsigned int has_nonlocal_label : 1;
41752284Sobrien
41890075Sobrien  /* Nonzero if function being compiled has nonlocal gotos to parent
41990075Sobrien     function.  */
42090075Sobrien  unsigned int has_nonlocal_goto : 1;
42152284Sobrien
42290075Sobrien  /* Nonzero if function being compiled contains nested functions.  */
42390075Sobrien  unsigned int contains_functions : 1;
42452284Sobrien
42590075Sobrien  /* Nonzero if the function being compiled issues a computed jump.  */
42690075Sobrien  unsigned int has_computed_jump : 1;
42752284Sobrien
42890075Sobrien  /* Nonzero if the current function is a thunk (a lightweight function that
42990075Sobrien     just adjusts one of its arguments and forwards to another function), so
43090075Sobrien     we should try to cut corners where we can.  */
43190075Sobrien  unsigned int is_thunk : 1;
43252284Sobrien
43390075Sobrien  /* Nonzero if instrumentation calls for function entry and exit should be
43490075Sobrien     generated.  */
43590075Sobrien  unsigned int instrument_entry_exit : 1;
43618334Speter
43790075Sobrien  /* Nonzero if profiling code should be generated.  */
43890075Sobrien  unsigned int profile : 1;
43990075Sobrien
44090075Sobrien  /* Nonzero if stack limit checking should be enabled in the current
44190075Sobrien     function.  */
44290075Sobrien  unsigned int limit_stack : 1;
44390075Sobrien
44490075Sobrien  /* Nonzero if current function uses varargs.h or equivalent.
44590075Sobrien     Zero for functions that use stdarg.h.  */
44690075Sobrien  unsigned int varargs : 1;
44790075Sobrien
44890075Sobrien  /* Nonzero if current function uses stdarg.h or equivalent.
44990075Sobrien     Zero for functions that use varargs.h.  */
45090075Sobrien  unsigned int stdarg : 1;
45190075Sobrien
45290075Sobrien  /* Nonzero if this function is being processed in function-at-a-time
45390075Sobrien     mode.  In other words, if all tree structure for this function,
45490075Sobrien     including the BLOCK tree, is created before RTL generation
45590075Sobrien     commences.  */
45690075Sobrien  unsigned int x_whole_function_mode_p : 1;
45790075Sobrien
45890075Sobrien  /* Nonzero if the back-end should not keep track of expressions that
45990075Sobrien     determine the size of variable-sized objects.  Normally, such
46090075Sobrien     expressions are saved away, and then expanded when the next
46190075Sobrien     function is started.  For example, if a parameter has a
46290075Sobrien     variable-sized type, then the size of the parameter is computed
46390075Sobrien     when the function body is entered.  However, some front-ends do
46490075Sobrien     not desire this behavior.  */
46590075Sobrien  unsigned int x_dont_save_pending_sizes_p : 1;
46690075Sobrien
46790075Sobrien  /* Nonzero if the current function uses the constant pool.  */
46890075Sobrien  unsigned int uses_const_pool : 1;
46990075Sobrien
47090075Sobrien  /* Nonzero if the current function uses pic_offset_table_rtx.  */
47190075Sobrien  unsigned int uses_pic_offset_table : 1;
47290075Sobrien
47390075Sobrien  /* Nonzero if the current function needs an lsda for exception handling.  */
47490075Sobrien  unsigned int uses_eh_lsda : 1;
47590075Sobrien
47690075Sobrien  /* Nonzero if code to initialize arg_pointer_save_area has been emited.  */
47790075Sobrien  unsigned int arg_pointer_save_area_init : 1;
47890075Sobrien};
47990075Sobrien
48090075Sobrien/* The function currently being compiled.  */
48190075Sobrienextern struct function *cfun;
48290075Sobrien
48390075Sobrien/* Nonzero if we've already converted virtual regs to hard regs.  */
48490075Sobrienextern int virtuals_instantiated;
48590075Sobrien
48690075Sobrien/* For backward compatibility... eventually these should all go away.  */
48790075Sobrien#define current_function_name (cfun->name)
48890075Sobrien#define current_function_pops_args (cfun->pops_args)
48990075Sobrien#define current_function_returns_struct (cfun->returns_struct)
49090075Sobrien#define current_function_returns_pcc_struct (cfun->returns_pcc_struct)
49190075Sobrien#define current_function_returns_pointer (cfun->returns_pointer)
49290075Sobrien#define current_function_needs_context (cfun->needs_context)
49390075Sobrien#define current_function_calls_setjmp (cfun->calls_setjmp)
49490075Sobrien#define current_function_calls_alloca (cfun->calls_alloca)
49590075Sobrien#define current_function_calls_longjmp (cfun->calls_longjmp)
49690075Sobrien#define current_function_calls_eh_return (cfun->calls_eh_return)
49790075Sobrien#define current_function_has_computed_jump (cfun->has_computed_jump)
49890075Sobrien#define current_function_contains_functions (cfun->contains_functions)
49990075Sobrien#define current_function_is_thunk (cfun->is_thunk)
50090075Sobrien#define current_function_args_info (cfun->args_info)
50190075Sobrien#define current_function_args_size (cfun->args_size)
50290075Sobrien#define current_function_pretend_args_size (cfun->pretend_args_size)
50390075Sobrien#define current_function_outgoing_args_size (cfun->outgoing_args_size)
50490075Sobrien#define current_function_arg_offset_rtx (cfun->arg_offset_rtx)
50590075Sobrien#define current_function_varargs (cfun->varargs)
50690075Sobrien#define current_function_stdarg (cfun->stdarg)
50790075Sobrien#define current_function_internal_arg_pointer (cfun->internal_arg_pointer)
50890075Sobrien#define current_function_return_rtx (cfun->return_rtx)
50990075Sobrien#define current_function_instrument_entry_exit (cfun->instrument_entry_exit)
51090075Sobrien#define current_function_profile (cfun->profile)
51190075Sobrien#define current_function_limit_stack (cfun->limit_stack)
51290075Sobrien#define current_function_uses_pic_offset_table (cfun->uses_pic_offset_table)
51390075Sobrien#define current_function_uses_const_pool (cfun->uses_const_pool)
51490075Sobrien#define current_function_cannot_inline (cfun->cannot_inline)
51590075Sobrien#define current_function_epilogue_delay_list (cfun->epilogue_delay_list)
51690075Sobrien#define current_function_has_nonlocal_label (cfun->has_nonlocal_label)
51790075Sobrien#define current_function_has_nonlocal_goto (cfun->has_nonlocal_goto)
51890075Sobrien
51990075Sobrien#define max_parm_reg (cfun->x_max_parm_reg)
52090075Sobrien#define parm_reg_stack_loc (cfun->x_parm_reg_stack_loc)
52190075Sobrien#define cleanup_label (cfun->x_cleanup_label)
52290075Sobrien#define return_label (cfun->x_return_label)
52390075Sobrien#define save_expr_regs (cfun->x_save_expr_regs)
52490075Sobrien#define stack_slot_list (cfun->x_stack_slot_list)
52590075Sobrien#define parm_birth_insn (cfun->x_parm_birth_insn)
52690075Sobrien#define frame_offset (cfun->x_frame_offset)
52790075Sobrien#define tail_recursion_label (cfun->x_tail_recursion_label)
52890075Sobrien#define tail_recursion_reentry (cfun->x_tail_recursion_reentry)
52990075Sobrien#define arg_pointer_save_area (cfun->x_arg_pointer_save_area)
53090075Sobrien#define rtl_expr_chain (cfun->x_rtl_expr_chain)
53190075Sobrien#define last_parm_insn (cfun->x_last_parm_insn)
53290075Sobrien#define context_display (cfun->x_context_display)
53390075Sobrien#define trampoline_list (cfun->x_trampoline_list)
53490075Sobrien#define function_call_count (cfun->x_function_call_count)
53590075Sobrien#define temp_slots (cfun->x_temp_slots)
53690075Sobrien#define temp_slot_level (cfun->x_temp_slot_level)
53790075Sobrien#define target_temp_slot_level (cfun->x_target_temp_slot_level)
53890075Sobrien#define var_temp_slot_level (cfun->x_var_temp_slot_level)
53990075Sobrien#define nonlocal_labels (cfun->x_nonlocal_labels)
54090075Sobrien#define nonlocal_goto_handler_slots (cfun->x_nonlocal_goto_handler_slots)
54190075Sobrien#define nonlocal_goto_handler_labels (cfun->x_nonlocal_goto_handler_labels)
54290075Sobrien#define nonlocal_goto_stack_level (cfun->x_nonlocal_goto_stack_level)
54390075Sobrien
54490075Sobrien/* The FUNCTION_DECL for an inline function currently being expanded.  */
54590075Sobrienextern tree inline_function_decl;
54690075Sobrien
54718334Speter/* Given a function decl for a containing function,
54818334Speter   return the `struct function' for it.  */
54990075Sobrienstruct function *find_function_data PARAMS ((tree));
55018334Speter
55190075Sobrien/* Set NOTE_BLOCK for each block note in the current function.  */
55290075Sobrienextern void identify_blocks PARAMS ((void));
55318334Speter
55490075Sobrien/* Identify BLOCKs referenced by more than one NOTE_INSN_BLOCK_{BEG,END},
55590075Sobrien   and create duplicate blocks.  */
55690075Sobrienextern void reorder_blocks PARAMS ((void));
55718334Speter
55890075Sobrien/* Set BLOCK_NUMBER for all the blocks in FN.  */
55990075Sobrienextern void number_blocks PARAMS ((tree));
56090075Sobrien
56150397Sobrien/* Return size needed for stack frame based on slots so far allocated.
56250397Sobrien   This size counts from zero.  It is not rounded to STACK_BOUNDARY;
56350397Sobrien   the caller may have to do that.  */
56490075Sobrienextern HOST_WIDE_INT get_frame_size	PARAMS ((void));
56590075Sobrien/* Likewise, but for a different than the current function.  */
56690075Sobrienextern HOST_WIDE_INT get_func_frame_size	PARAMS ((struct function *));
56750397Sobrien
56890075Sobrien/* These variables hold pointers to functions to create and destroy
56990075Sobrien   target specific, per-function data structures.  */
57090075Sobrienextern void (*init_machine_status)	PARAMS ((struct function *));
57190075Sobrienextern void (*free_machine_status)	PARAMS ((struct function *));
57290075Sobrien/* This variable holds a pointer to a function to register any
57390075Sobrien   data items in the target specific, per-function data structure
57490075Sobrien   that will need garbage collection.  */
57590075Sobrienextern void (*mark_machine_status)	PARAMS ((struct function *));
57618334Speter
57790075Sobrien/* Likewise, but for language-specific data.  */
57890075Sobrienextern void (*init_lang_status)         PARAMS ((struct function *));
57990075Sobrienextern void (*mark_lang_status)		PARAMS ((struct function *));
58090075Sobrienextern void (*save_lang_status)		PARAMS ((struct function *));
58190075Sobrienextern void (*restore_lang_status)	PARAMS ((struct function *));
58290075Sobrienextern void (*free_lang_status)         PARAMS ((struct function *));
58390075Sobrien
58450397Sobrien/* Save and restore status information for a nested function.  */
58590075Sobrienextern void restore_emit_status		PARAMS ((struct function *));
58690075Sobrienextern void free_after_parsing		PARAMS ((struct function *));
58790075Sobrienextern void free_after_compilation	PARAMS ((struct function *));
58818334Speter
58990075Sobrienextern void init_varasm_status		PARAMS ((struct function *));
59090075Sobrienextern void free_varasm_status		PARAMS ((struct function *));
59190075Sobrienextern void free_emit_status		PARAMS ((struct function *));
59290075Sobrienextern void free_stmt_status            PARAMS ((struct function *));
59390075Sobrienextern void free_eh_status		PARAMS ((struct function *));
59490075Sobrienextern void free_expr_status		PARAMS ((struct function *));
59550397Sobrien
59690075Sobrienextern rtx get_first_block_beg		PARAMS ((void));
59790075Sobrien
59890075Sobrien#ifdef RTX_CODE
59990075Sobrienextern void diddle_return_value		PARAMS ((void (*)(rtx, void*), void*));
60090075Sobrienextern void clobber_return_register	PARAMS ((void));
60190075Sobrienextern void use_return_register		PARAMS ((void));
60218334Speter#endif
60318334Speter
60490075Sobrienextern rtx get_arg_pointer_save_area	PARAMS ((struct function *));
60590075Sobrien
60690075Sobrienextern void init_virtual_regs		PARAMS ((struct emit_status *));
60790075Sobrien
60890075Sobrien/* Called once, at initialization, to initialize function.c.  */
60990075Sobrienextern void init_function_once          PARAMS ((void));
610