/* Structure for saving state for a nested function.
Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2003 Free Software Foundation, Inc.
+ 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
This file is part of GCC.
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
+#ifndef GCC_FUNCTION_H
+#define GCC_FUNCTION_H
+
struct var_refs_queue GTY(())
{
rtx modified;
struct emit_status *emit;
struct varasm_status *varasm;
- /* For function.c. */
+ /* For tree-optimize.c. */
- /* Name of this function. */
- const char *name;
+ /* Saved tree and arguments during tree optimization. Used later for
+ inlining */
+ tree saved_tree;
+ tree saved_args;
+
+ /* For function.c. */
/* Points to the FUNCTION_DECL of this function. */
tree decl;
/* Number of function calls seen so far in current function. */
int x_function_call_count;
- /* List (chain of TREE_LIST) of LABEL_DECLs for all nonlocal labels
- (labels to which there can be nonlocal gotos from nested functions)
- in this function. */
- tree x_nonlocal_labels;
-
- /* List (chain of EXPR_LIST) of stack slots that hold the current handlers
- for nonlocal gotos. There is one for every nonlocal label in the
- function; this list matches the one in nonlocal_labels.
- Zero when function does not have nonlocal labels. */
- rtx x_nonlocal_goto_handler_slots;
-
/* List (chain of EXPR_LIST) of labels heading the current handlers for
nonlocal gotos. */
rtx x_nonlocal_goto_handler_labels;
- /* RTX for stack slot that holds the stack pointer value to restore
- for a nonlocal goto.
- Zero when function does not have nonlocal labels. */
- rtx x_nonlocal_goto_stack_level;
-
/* Label that will go on parm cleanup code, if any.
Jumping to this label runs cleanup code for parameters, if
such code must be run. Following this code is the logical return
on machines which require execution of the epilogue on all returns. */
rtx x_return_label;
+ /* Label that will go on the end of function epilogue.
+ Jumping to this label serves as a "naked return" instruction
+ on machines which require execution of the epilogue on all returns. */
+ rtx x_naked_return_label;
+
/* Label and register for unswitching computed gotos. */
rtx computed_goto_common_label;
rtx computed_goto_common_reg;
needed by inner routines. */
rtx x_arg_pointer_save_area;
- /* If the function returns non-void, we will emit a clobber of the
- return registers just in case the user fell off the end without
- returning a proper value. This is that insn. */
- rtx x_clobber_return_insn;
-
/* Offset to end of allocated area of stack frame.
If stack grows down, this is the address of the last stack slot allocated.
If stack grows up, this is the address for the next slot. */
HOST_WIDE_INT x_frame_offset;
- /* List (chain of TREE_LISTs) of static chains for containing functions.
- Each link has a FUNCTION_DECL in the TREE_PURPOSE and a reg rtx
- in an RTL_EXPR in the TREE_VALUE. */
- tree x_context_display;
+ /* A VAR_DECL that should contain the static chain for this function.
+ It will be initialized at the beginning of the function. */
+ tree static_chain_decl;
- /* List (chain of TREE_LISTs) of trampolines for nested functions.
- The trampoline sets up the static chain and jumps to the function.
- We supply the trampoline's address when the function's address is
- requested.
-
- Each link has a FUNCTION_DECL in the TREE_PURPOSE and a reg rtx
- in an RTL_EXPR in the TREE_VALUE. */
- tree x_trampoline_list;
+ /* An expression that contains the non-local goto save area. The first
+ word is the saved frame pointer and the second is the saved stack
+ pointer. */
+ tree nonlocal_goto_save_area;
/* Insn after which register parms and SAVE_EXPRs are born, if nonopt. */
rtx x_parm_birth_insn;
element in this vector is one less than MAX_PARM_REG, above. */
rtx * GTY ((length ("%h.x_max_parm_reg"))) x_parm_reg_stack_loc;
- /* List of all temporaries allocated, both available and in use. */
- struct temp_slot *x_temp_slots;
+ /* List of all used temporaries allocated, by level. */
+ struct varray_head_tag * GTY((param_is (struct temp_slot))) x_used_temp_slots;
+
+ /* List of available temp slots. */
+ struct temp_slot *x_avail_temp_slots;
/* Current nesting level for temporaries. */
int x_temp_slot_level;
/* For md files. */
/* tm.h can use this to store whatever it likes. */
- struct machine_function * GTY ((maybe_undef (""))) machine;
+ struct machine_function * GTY ((maybe_undef)) machine;
/* The largest alignment of slot allocated on the stack. */
int stack_alignment_needed;
/* Preferred alignment of the end of stack frame. */
int preferred_stack_boundary;
/* Set when the call to function itself has been emit. */
bool recursive_call_emit;
+ /* Set when the tail call has been produced. */
+ bool tail_call_emit;
/* Language-specific code can use this to store whatever it likes. */
struct language_function * language;
delay list for them is recorded here. */
rtx epilogue_delay_list;
+ /* Nonzero if NOTE_INSN_BLOCK_BEG / NOTE_INSN_BLOCK_END notes should not
+ be emitted. */
+ unsigned int dont_emit_block_notes : 1;
+
/* How commonly executed the function is. Initialized during branch
probabilities pass. */
enum function_frequency {
final flowgraph size. */
int max_jumptable_ents;
+ /* UIDs for LABEL_DECLs. */
+ int last_label_uid;
+
+ /* Line number of the end of the function. */
+ location_t function_end_locus;
+
+ /* Array mapping insn uids to blocks. */
+ struct varray_head_tag *ib_boundaries_block;
+
+ /* The variables unexpanded so far. */
+ tree unexpanded_var_list;
+
/* Collected bit flags. */
/* Nonzero if function being compiled needs to be given an address
/* Nonzero if the current function returns a pointer type. */
unsigned int returns_pointer : 1;
- /* Nonzero if function being compiled needs to be passed a static chain. */
- unsigned int needs_context : 1;
-
/* Nonzero if function being compiled can call setjmp. */
unsigned int calls_setjmp : 1;
/* Nonzero if the function calls __builtin_eh_return. */
unsigned int calls_eh_return : 1;
- /* Nonzero if the function calls __builtin_constant_p. */
- unsigned int calls_constant_p : 1;
-
/* Nonzero if function being compiled receives nonlocal gotos
from nested functions. */
unsigned int has_nonlocal_label : 1;
/* Nonzero if the function being compiled issues a computed jump. */
unsigned int has_computed_jump : 1;
- /* Nonzero if the current function is a thunk (a lightweight function that
- just adjusts one of its arguments and forwards to another function), so
- we should try to cut corners where we can. */
+ /* Nonzero if the current function is a thunk, i.e., a lightweight
+ function implemented by the output_mi_thunk hook) that just
+ adjusts one of its arguments and forwards to another
+ function. */
unsigned int is_thunk : 1;
/* This bit is used by the exception handling logic. It is set if all
/* The function currently being compiled. */
extern GTY(()) struct function *cfun;
+/* Pointer to chain of `struct function' for containing functions. */
+extern GTY(()) struct function *outer_function_chain;
+
/* Nonzero if we've already converted virtual regs to hard regs. */
extern int virtuals_instantiated;
extern int trampolines_created;
/* For backward compatibility... eventually these should all go away. */
-#define current_function_name (cfun->name)
#define current_function_pops_args (cfun->pops_args)
#define current_function_returns_struct (cfun->returns_struct)
#define current_function_returns_pcc_struct (cfun->returns_pcc_struct)
#define current_function_returns_pointer (cfun->returns_pointer)
-#define current_function_needs_context (cfun->needs_context)
#define current_function_calls_setjmp (cfun->calls_setjmp)
#define current_function_calls_alloca (cfun->calls_alloca)
#define current_function_calls_longjmp (cfun->calls_longjmp)
#define current_function_calls_eh_return (cfun->calls_eh_return)
-#define current_function_calls_constant_p (cfun->calls_constant_p)
#define current_function_has_computed_jump (cfun->has_computed_jump)
#define current_function_contains_functions (cfun->contains_functions)
#define current_function_is_thunk (cfun->is_thunk)
#define parm_reg_stack_loc (cfun->x_parm_reg_stack_loc)
#define cleanup_label (cfun->x_cleanup_label)
#define return_label (cfun->x_return_label)
+#define naked_return_label (cfun->x_naked_return_label)
#define save_expr_regs (cfun->x_save_expr_regs)
#define stack_slot_list (cfun->x_stack_slot_list)
#define parm_birth_insn (cfun->x_parm_birth_insn)
#define arg_pointer_save_area (cfun->x_arg_pointer_save_area)
#define rtl_expr_chain (cfun->x_rtl_expr_chain)
#define last_parm_insn (cfun->x_last_parm_insn)
-#define context_display (cfun->x_context_display)
-#define trampoline_list (cfun->x_trampoline_list)
#define function_call_count (cfun->x_function_call_count)
-#define temp_slots (cfun->x_temp_slots)
+#define used_temp_slots (cfun->x_used_temp_slots)
+#define avail_temp_slots (cfun->x_avail_temp_slots)
#define temp_slot_level (cfun->x_temp_slot_level)
#define target_temp_slot_level (cfun->x_target_temp_slot_level)
#define var_temp_slot_level (cfun->x_var_temp_slot_level)
#define nonlocal_labels (cfun->x_nonlocal_labels)
-#define nonlocal_goto_handler_slots (cfun->x_nonlocal_goto_handler_slots)
#define nonlocal_goto_handler_labels (cfun->x_nonlocal_goto_handler_labels)
-#define nonlocal_goto_stack_level (cfun->x_nonlocal_goto_stack_level)
-
-/* The FUNCTION_DECL for an inline function currently being expanded. */
-extern tree inline_function_decl;
/* Given a function decl for a containing function,
return the `struct function' for it. */
/* Set BLOCK_NUMBER for all the blocks in FN. */
extern void number_blocks (tree);
+extern void clear_block_marks (tree);
+extern tree blocks_nreverse (tree);
+extern void reset_block_changes (void);
+extern void record_block_change (tree);
+extern void finalize_block_changes (void);
+extern void check_block_change (rtx, tree *);
+extern void free_block_changes (void);
+
/* Return size needed for stack frame based on slots so far allocated.
This size counts from zero. It is not rounded to STACK_BOUNDARY;
the caller may have to do that. */
extern void init_virtual_regs (struct emit_status *);
+/* Returns the name of the current function. */
+extern const char *current_function_name (void);
+
/* Called once, at initialization, to initialize function.c. */
extern void init_function_once (void);
+
+extern void do_warn_unused_parameter (tree);
+
+#endif /* GCC_FUNCTION_H */