Commit 3a70d621 by Richard Henderson Committed by Richard Henderson

function.c (allocate_struct_function): New, split out of ...

        * function.c (allocate_struct_function): New, split out of ...
        (prepare_function_start, init_function_start): ... here.
        * expr.c (init_expr): Use ggc_alloc_cleared.
        * stmt.c (init_stmt_for_function): Likewise.
        * tree.h (allocate_struct_function): Declare.

From-SVN: r70929
parent 23b6da10
2003-08-29 Richard Henderson <rth@redhat.com>
* function.c (allocate_struct_function): New, split out of ...
(prepare_function_start, init_function_start): ... here.
* expr.c (init_expr): Use ggc_alloc_cleared.
* stmt.c (init_stmt_for_function): Likewise.
* tree.h (allocate_struct_function): Declare.
2003-08-29 Nathanael Nerode <neroden@gcc.gnu.org> 2003-08-29 Nathanael Nerode <neroden@gcc.gnu.org>
* config.gcc: Don't use negated character class in shell case * config.gcc: Don't use negated character class in shell case
......
...@@ -338,15 +338,7 @@ init_expr_once (void) ...@@ -338,15 +338,7 @@ init_expr_once (void)
void void
init_expr (void) init_expr (void)
{ {
cfun->expr = ggc_alloc (sizeof (struct expr_status)); cfun->expr = ggc_alloc_cleared (sizeof (struct expr_status));
pending_chain = 0;
pending_stack_adjust = 0;
stack_pointer_delta = 0;
inhibit_defer_pop = 0;
saveregs_value = 0;
apply_args_value = 0;
forced_labels = 0;
} }
/* Small sanity check that the queue is empty at the end of a function. */ /* Small sanity check that the queue is empty at the end of a function. */
......
...@@ -284,7 +284,7 @@ static hashval_t insns_for_mem_hash (const void *); ...@@ -284,7 +284,7 @@ static hashval_t insns_for_mem_hash (const void *);
static int insns_for_mem_comp (const void *, const void *); static int insns_for_mem_comp (const void *, const void *);
static int insns_for_mem_walk (rtx *, void *); static int insns_for_mem_walk (rtx *, void *);
static void compute_insns_for_mem (rtx, rtx, htab_t); static void compute_insns_for_mem (rtx, rtx, htab_t);
static void prepare_function_start (void); static void prepare_function_start (tree);
static void do_clobber_return_reg (rtx, void *); static void do_clobber_return_reg (rtx, void *);
static void do_use_return_reg (rtx, void *); static void do_use_return_reg (rtx, void *);
static void instantiate_virtual_regs_lossage (rtx); static void instantiate_virtual_regs_lossage (rtx);
...@@ -6246,103 +6246,77 @@ debug_find_var_in_block_tree (tree var, tree block) ...@@ -6246,103 +6246,77 @@ debug_find_var_in_block_tree (tree var, tree block)
return NULL_TREE; return NULL_TREE;
} }
/* Allocate a function structure and reset its contents to the defaults. */ /* Allocate a function structure for FNDECL and set its contents
to the defaults. */
static void void
prepare_function_start (void) allocate_struct_function (tree fndecl)
{ {
cfun = ggc_alloc_cleared (sizeof (struct function)); tree result;
init_stmt_for_function ();
init_eh_for_function ();
cse_not_expected = ! optimize;
/* Caller save not needed yet. */
caller_save_needed = 0;
/* No stack slots have been made yet. */
stack_slot_list = 0;
current_function_has_nonlocal_label = 0; cfun = ggc_alloc_cleared (sizeof (struct function));
current_function_has_nonlocal_goto = 0;
/* There is no stack slot for handling nonlocal gotos. */ max_parm_reg = LAST_VIRTUAL_REGISTER + 1;
nonlocal_goto_handler_slots = 0;
nonlocal_goto_stack_level = 0;
/* No labels have been declared for nonlocal use. */ cfun->stack_alignment_needed = STACK_BOUNDARY;
nonlocal_labels = 0; cfun->preferred_stack_boundary = STACK_BOUNDARY;
nonlocal_goto_handler_labels = 0;
/* No function calls so far in this function. */ current_function_funcdef_no = funcdef_no++;
function_call_count = 0;
/* No parm regs have been allocated. cfun->function_frequency = FUNCTION_FREQUENCY_NORMAL;
(This is important for output_inline_function.) */
max_parm_reg = LAST_VIRTUAL_REGISTER + 1;
/* Initialize the RTL mechanism. */ init_stmt_for_function ();
init_eh_for_function ();
init_emit (); init_emit ();
/* Initialize the queue of pending postincrement and postdecrements,
and some other info in expr.c. */
init_expr (); init_expr ();
/* We haven't done register allocation yet. */
reg_renumber = 0;
init_varasm_status (cfun); init_varasm_status (cfun);
/* Clear out data used for inlining. */ (*lang_hooks.function.init) (cfun);
cfun->inlinable = 0; if (init_machine_status)
cfun->original_decl_initial = 0; cfun->machine = (*init_machine_status) ();
cfun->original_arg_vector = 0;
cfun->stack_alignment_needed = STACK_BOUNDARY; if (fndecl == NULL)
cfun->preferred_stack_boundary = STACK_BOUNDARY; return;
/* Set if a call to setjmp is seen. */ DECL_SAVED_INSNS (fndecl) = cfun;
current_function_calls_setjmp = 0; cfun->decl = fndecl;
/* Set if a call to longjmp is seen. */ current_function_name = (*lang_hooks.decl_printable_name) (fndecl, 2);
current_function_calls_longjmp = 0;
current_function_calls_alloca = 0; result = DECL_RESULT (fndecl);
current_function_calls_eh_return = 0; if (aggregate_value_p (result))
current_function_calls_constant_p = 0; {
current_function_contains_functions = 0; #ifdef PCC_STATIC_STRUCT_RETURN
current_function_is_leaf = 0; current_function_returns_pcc_struct = 1;
current_function_nothrow = 0; #endif
current_function_sp_is_unchanging = 0; current_function_returns_struct = 1;
current_function_uses_only_leaf_regs = 0; }
current_function_has_computed_jump = 0;
current_function_is_thunk = 0;
current_function_returns_pcc_struct = 0; current_function_returns_pointer = POINTER_TYPE_P (TREE_TYPE (result));
current_function_returns_struct = 0;
current_function_epilogue_delay_list = 0;
current_function_uses_const_pool = 0;
current_function_uses_pic_offset_table = 0;
current_function_cannot_inline = 0;
/* We have not yet needed to make a label to jump to for tail-recursion. */ current_function_needs_context
tail_recursion_label = 0; = (decl_function_context (current_function_decl) != 0
&& ! DECL_NO_STATIC_CHAIN (current_function_decl));
}
/* We haven't had a need to make a save area for ap yet. */ /* Reset cfun, and other non-struct-function variables to defaults as
arg_pointer_save_area = 0; appropriate for emiiting rtl at the start of a function. */
/* No stack slots allocated yet. */ static void
frame_offset = 0; prepare_function_start (tree fndecl)
{
if (fndecl && DECL_SAVED_INSNS (fndecl))
cfun = DECL_SAVED_INSNS (fndecl);
else
allocate_struct_function (fndecl);
/* No SAVE_EXPRs in this function yet. */ cse_not_expected = ! optimize;
save_expr_regs = 0;
/* No RTL_EXPRs in this function yet. */ /* Caller save not needed yet. */
rtl_expr_chain = 0; caller_save_needed = 0;
/* Set up to allocate temporaries. */ /* We haven't done register allocation yet. */
init_temp_slots (); reg_renumber = 0;
/* Indicate that we need to distinguish between the return value of the /* Indicate that we need to distinguish between the return value of the
present function and the return value of a function being called. */ present function and the return value of a function being called. */
...@@ -6356,27 +6330,6 @@ prepare_function_start (void) ...@@ -6356,27 +6330,6 @@ prepare_function_start (void)
/* Indicate we have no need of a frame pointer yet. */ /* Indicate we have no need of a frame pointer yet. */
frame_pointer_needed = 0; frame_pointer_needed = 0;
/* By default assume not stdarg. */
current_function_stdarg = 0;
/* We haven't made any trampolines for this function yet. */
trampoline_list = 0;
init_pending_stack_adjust ();
inhibit_defer_pop = 0;
current_function_outgoing_args_size = 0;
current_function_funcdef_no = funcdef_no++;
cfun->function_frequency = FUNCTION_FREQUENCY_NORMAL;
cfun->max_jumptable_ents = 0;
(*lang_hooks.function.init) (cfun);
if (init_machine_status)
cfun->machine = (*init_machine_status) ();
} }
/* Initialize the rtl expansion mechanism so that we can do simple things /* Initialize the rtl expansion mechanism so that we can do simple things
...@@ -6385,7 +6338,7 @@ prepare_function_start (void) ...@@ -6385,7 +6338,7 @@ prepare_function_start (void)
void void
init_dummy_function_start (void) init_dummy_function_start (void)
{ {
prepare_function_start (); prepare_function_start (NULL);
} }
/* Generate RTL for the start of the function SUBR (a FUNCTION_DECL tree node) /* Generate RTL for the start of the function SUBR (a FUNCTION_DECL tree node)
...@@ -6395,16 +6348,7 @@ init_dummy_function_start (void) ...@@ -6395,16 +6348,7 @@ init_dummy_function_start (void)
void void
init_function_start (tree subr) init_function_start (tree subr)
{ {
prepare_function_start (); prepare_function_start (subr);
current_function_name = (*lang_hooks.decl_printable_name) (subr, 2);
cfun->decl = subr;
/* Nonzero if this is a nested function that uses a static chain. */
current_function_needs_context
= (decl_function_context (current_function_decl) != 0
&& ! DECL_NO_STATIC_CHAIN (current_function_decl));
/* Within function body, compute a type's size as soon it is laid out. */ /* Within function body, compute a type's size as soon it is laid out. */
immediate_size_expand++; immediate_size_expand++;
...@@ -6421,23 +6365,11 @@ init_function_start (tree subr) ...@@ -6421,23 +6365,11 @@ init_function_start (tree subr)
Also, final expects a note to appear there. */ Also, final expects a note to appear there. */
emit_note (NOTE_INSN_DELETED); emit_note (NOTE_INSN_DELETED);
/* Set flags used by final.c. */
if (aggregate_value_p (DECL_RESULT (subr)))
{
#ifdef PCC_STATIC_STRUCT_RETURN
current_function_returns_pcc_struct = 1;
#endif
current_function_returns_struct = 1;
}
/* Warn if this value is an aggregate type, /* Warn if this value is an aggregate type,
regardless of which calling convention we are using for it. */ regardless of which calling convention we are using for it. */
if (warn_aggregate_return if (warn_aggregate_return
&& AGGREGATE_TYPE_P (TREE_TYPE (DECL_RESULT (subr)))) && AGGREGATE_TYPE_P (TREE_TYPE (DECL_RESULT (subr))))
warning ("function returns an aggregate"); warning ("function returns an aggregate");
current_function_returns_pointer
= POINTER_TYPE_P (TREE_TYPE (DECL_RESULT (subr)));
} }
/* Make sure all values used by the optimization passes have sane /* Make sure all values used by the optimization passes have sane
......
...@@ -433,25 +433,7 @@ using_eh_for_cleanups (void) ...@@ -433,25 +433,7 @@ using_eh_for_cleanups (void)
void void
init_stmt_for_function (void) init_stmt_for_function (void)
{ {
cfun->stmt =ggc_alloc (sizeof (struct stmt_status)); cfun->stmt = ggc_alloc_cleared (sizeof (struct stmt_status));
/* We are not currently within any block, conditional, loop or case. */
block_stack = 0;
stack_block_stack = 0;
loop_stack = 0;
case_stack = 0;
cond_stack = 0;
nesting_stack = 0;
nesting_depth = 0;
current_block_start_count = 0;
/* No gotos have been expanded yet. */
goto_fixup_chain = 0;
/* We are not processing a ({...}) grouping. */
expr_stmts_for_value = 0;
clear_last_expr ();
} }
/* Record the current file and line. Called from emit_line_note. */ /* Record the current file and line. Called from emit_line_note. */
......
...@@ -2856,6 +2856,7 @@ extern void expand_main_function (void); ...@@ -2856,6 +2856,7 @@ extern void expand_main_function (void);
extern void init_dummy_function_start (void); extern void init_dummy_function_start (void);
extern void expand_dummy_function_end (void); extern void expand_dummy_function_end (void);
extern void init_function_for_compilation (void); extern void init_function_for_compilation (void);
extern void allocate_struct_function (tree);
extern void init_function_start (tree); extern void init_function_start (tree);
extern void assign_parms (tree); extern void assign_parms (tree);
extern void put_var_into_stack (tree, int); extern void put_var_into_stack (tree, int);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment