From bd60bab2ad76a635640db0101275111be8b04987 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Mon, 31 Mar 2008 19:08:31 +0200 Subject: [PATCH] builtins.c (expand_builtin_setjmp_receiver): Update call of get_arg_pointer_save_area. * builtins.c (expand_builtin_setjmp_receiver): Update call of get_arg_pointer_save_area. * expr.c (init_expr): Just clear out rtl.expr. * function.c (free_after_compilation): Clear out whole RTL structure. (get_func_frame_size): Merge into ... (get_frame_size): ... this one. (assign_stack_local_1): Merge into ... (assign_stack_local): ... this one. (expand_function_end): Update call of get_arg_pointer_save_area. (get_art_pointer_save_area): Remove cfun argument. * function.h (emit_status): regno_pointer_align does not need length attribute. Move x_regno_reg_rtx to ... (regno_reg_rtx): ... new global array. (reg_rtx_no, seq_stack, REGNO_POINTER_ALIGN): Update accestors. (pending_stack_adjust, inhibit_defer_pop, saveregs_value, apply_args_value, forced_labels, stack_pointer_delta): Update accestors. (struct varasm_status): Move here from varasm.c (struct rtl_data): New. Move here some fields from struct function. (return_label, naked_return_label, stack_slot_list, parm_birth_insn, frame_offset, stack_check_probe_note, arg_pointer_save_area, used_temp_slots avail_temp_slots, temp_slot_level, nonlocal_goto_handler_labels): Update accesstors. (rtl): New global variable. (struct function): Move some fileds to rtl_data. (get_arg_pointer_save_area): Update prototype. * emit-rtl.c (rtl): Declare. (regno_reg_rtx): Declare. (first_insn, last_insn, cur_insn_uid, last_location, first_label_num): Update. (gen_reg_rtx): Update. (init_virtual_regs): Do not tate emit_status argument. (init_emit): Do not allocate emit. * varasm.c (varasm_statuc): Move to function.h. (n_deferred_constatns): Update accestor. (init_varasm_status): Do not allocate varasm_status. (force_const_mem, get_pool_size, output_constant_pool): Update. * stmt.c (force_label_rtx): Do not use x_ prefixes. (expand_nl_goto_receiver): Update get_arg_pointer_save_area. From-SVN: r133759 --- gcc/ChangeLog | 40 +++++++++++ gcc/builtins.c | 2 +- gcc/emit-rtl.c | 61 +++++++++-------- gcc/expr.c | 2 +- gcc/function.c | 99 +++++++++------------------ gcc/function.h | 179 +++++++++++++++++++++++++++---------------------- gcc/stmt.c | 5 +- gcc/varasm.c | 29 ++------ 8 files changed, 213 insertions(+), 204 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a78eae84de0..bc37e45d019 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,43 @@ +2008-03-31 Jan Hubicka + + * builtins.c (expand_builtin_setjmp_receiver): Update call of + get_arg_pointer_save_area. + * expr.c (init_expr): Just clear out rtl.expr. + * function.c (free_after_compilation): Clear out whole RTL structure. + (get_func_frame_size): Merge into ... + (get_frame_size): ... this one. + (assign_stack_local_1): Merge into ... + (assign_stack_local): ... this one. + (expand_function_end): Update call of get_arg_pointer_save_area. + (get_art_pointer_save_area): Remove cfun argument. + * function.h (emit_status): regno_pointer_align does not need length + attribute. Move x_regno_reg_rtx to ... + (regno_reg_rtx): ... new global array. + (reg_rtx_no, seq_stack, REGNO_POINTER_ALIGN): Update accestors. + (pending_stack_adjust, inhibit_defer_pop, saveregs_value, + apply_args_value, forced_labels, stack_pointer_delta): Update accestors. + (struct varasm_status): Move here from varasm.c + (struct rtl_data): New. Move here some fields from struct function. + (return_label, naked_return_label, stack_slot_list, parm_birth_insn, + frame_offset, stack_check_probe_note, arg_pointer_save_area, + used_temp_slots avail_temp_slots, temp_slot_level, + nonlocal_goto_handler_labels): Update accesstors. + (rtl): New global variable. + (struct function): Move some fileds to rtl_data. + (get_arg_pointer_save_area): Update prototype. + * emit-rtl.c (rtl): Declare. + (regno_reg_rtx): Declare. + (first_insn, last_insn, cur_insn_uid, last_location, first_label_num): Update. + (gen_reg_rtx): Update. + (init_virtual_regs): Do not tate emit_status argument. + (init_emit): Do not allocate emit. + * varasm.c (varasm_statuc): Move to function.h. + (n_deferred_constatns): Update accestor. + (init_varasm_status): Do not allocate varasm_status. + (force_const_mem, get_pool_size, output_constant_pool): Update. + * stmt.c (force_label_rtx): Do not use x_ prefixes. + (expand_nl_goto_receiver): Update get_arg_pointer_save_area. + 2008-03-31 Zdenek Dvorak PR rtl-optimization/35729 diff --git a/gcc/builtins.c b/gcc/builtins.c index d07fed88614..f268738bb7d 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -741,7 +741,7 @@ expand_builtin_setjmp_receiver (rtx receiver_label ATTRIBUTE_UNUSED) /* Now restore our arg pointer from the address at which it was saved in our stack frame. */ emit_move_insn (virtual_incoming_args_rtx, - copy_to_reg (get_arg_pointer_save_area (cfun))); + copy_to_reg (get_arg_pointer_save_area ())); } } #endif diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 77889cf9d54..d000ee06b43 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -66,6 +66,16 @@ enum machine_mode word_mode; /* Mode whose width is BITS_PER_WORD. */ enum machine_mode double_mode; /* Mode whose width is DOUBLE_TYPE_SIZE. */ enum machine_mode ptr_mode; /* Mode whose width is POINTER_SIZE. */ +/* Datastructures maintained for currently processed function in RTL form. */ + +struct rtl_data rtl; + +/* Indexed by pseudo register number, gives the rtx for that pseudo. + Allocated in parallel with regno_pointer_align. + FIXME: We could put it into emit_status struct, but gengtype is not able to deal + with length attribute nested in top level structures. */ + +rtx * regno_reg_rtx; /* This is *not* reset after each function. It gives each CODE_LABEL in the entire compilation a unique label number. */ @@ -162,11 +172,11 @@ static GTY ((if_marked ("ggc_marked_p"), param_is (struct rtx_def))) static GTY ((if_marked ("ggc_marked_p"), param_is (struct rtx_def))) htab_t const_fixed_htab; -#define first_insn (cfun->emit->x_first_insn) -#define last_insn (cfun->emit->x_last_insn) -#define cur_insn_uid (cfun->emit->x_cur_insn_uid) -#define last_location (cfun->emit->x_last_location) -#define first_label_num (cfun->emit->x_first_label_num) +#define first_insn (rtl.emit.x_first_insn) +#define last_insn (rtl.emit.x_last_insn) +#define cur_insn_uid (rtl.emit.x_cur_insn_uid) +#define last_location (rtl.emit.x_last_location) +#define first_label_num (rtl.emit.x_first_label_num) static rtx make_call_insn_raw (rtx); static rtx change_address_1 (rtx, enum machine_mode, rtx, int); @@ -853,7 +863,6 @@ byte_lowpart_offset (enum machine_mode outer_mode, rtx gen_reg_rtx (enum machine_mode mode) { - struct function *f = cfun; rtx val; gcc_assert (can_create_pseudo_p ()); @@ -878,22 +887,22 @@ gen_reg_rtx (enum machine_mode mode) /* Make sure regno_pointer_align, and regno_reg_rtx are large enough to have an element for this pseudo reg number. */ - if (reg_rtx_no == f->emit->regno_pointer_align_length) + if (reg_rtx_no == rtl.emit.regno_pointer_align_length) { - int old_size = f->emit->regno_pointer_align_length; + int old_size = rtl.emit.regno_pointer_align_length; char *new; rtx *new1; - new = ggc_realloc (f->emit->regno_pointer_align, old_size * 2); + new = xrealloc (rtl.emit.regno_pointer_align, old_size * 2); memset (new + old_size, 0, old_size); - f->emit->regno_pointer_align = (unsigned char *) new; + rtl.emit.regno_pointer_align = (unsigned char *) new; - new1 = ggc_realloc (f->emit->x_regno_reg_rtx, + new1 = ggc_realloc (regno_reg_rtx, old_size * 2 * sizeof (rtx)); memset (new1 + old_size, 0, old_size * sizeof (rtx)); regno_reg_rtx = new1; - f->emit->regno_pointer_align_length = old_size * 2; + rtl.emit.regno_pointer_align_length = old_size * 2; } val = gen_raw_REG (mode, reg_rtx_no); @@ -4789,14 +4798,13 @@ in_sequence_p (void) /* Put the various virtual registers into REGNO_REG_RTX. */ static void -init_virtual_regs (struct emit_status *es) +init_virtual_regs (void) { - rtx *ptr = es->x_regno_reg_rtx; - ptr[VIRTUAL_INCOMING_ARGS_REGNUM] = virtual_incoming_args_rtx; - ptr[VIRTUAL_STACK_VARS_REGNUM] = virtual_stack_vars_rtx; - ptr[VIRTUAL_STACK_DYNAMIC_REGNUM] = virtual_stack_dynamic_rtx; - ptr[VIRTUAL_OUTGOING_ARGS_REGNUM] = virtual_outgoing_args_rtx; - ptr[VIRTUAL_CFA_REGNUM] = virtual_cfa_rtx; + regno_reg_rtx[VIRTUAL_INCOMING_ARGS_REGNUM] = virtual_incoming_args_rtx; + regno_reg_rtx[VIRTUAL_STACK_VARS_REGNUM] = virtual_stack_vars_rtx; + regno_reg_rtx[VIRTUAL_STACK_DYNAMIC_REGNUM] = virtual_stack_dynamic_rtx; + regno_reg_rtx[VIRTUAL_OUTGOING_ARGS_REGNUM] = virtual_outgoing_args_rtx; + regno_reg_rtx[VIRTUAL_CFA_REGNUM] = virtual_cfa_rtx; } @@ -4970,9 +4978,6 @@ copy_insn (rtx insn) void init_emit (void) { - struct function *f = cfun; - - f->emit = ggc_alloc (sizeof (struct emit_status)); first_insn = NULL; last_insn = NULL; cur_insn_uid = 1; @@ -4983,14 +4988,14 @@ init_emit (void) /* Init the tables that describe all the pseudo regs. */ - f->emit->regno_pointer_align_length = LAST_VIRTUAL_REGISTER + 101; + rtl.emit.regno_pointer_align_length = LAST_VIRTUAL_REGISTER + 101; - f->emit->regno_pointer_align - = ggc_alloc_cleared (f->emit->regno_pointer_align_length - * sizeof (unsigned char)); + rtl.emit.regno_pointer_align + = xmalloc (rtl.emit.regno_pointer_align_length + * sizeof (unsigned char)); regno_reg_rtx - = ggc_alloc (f->emit->regno_pointer_align_length * sizeof (rtx)); + = ggc_alloc (rtl.emit.regno_pointer_align_length * sizeof (rtx)); /* Put copies of all the hard registers into regno_reg_rtx. */ memcpy (regno_reg_rtx, @@ -4998,7 +5003,7 @@ init_emit (void) FIRST_PSEUDO_REGISTER * sizeof (rtx)); /* Put copies of all the virtual register rtx into regno_reg_rtx. */ - init_virtual_regs (f->emit); + init_virtual_regs (); /* Indicate that the virtual registers and stack locations are all pointers. */ diff --git a/gcc/expr.c b/gcc/expr.c index 7e1a0ffa85b..7ecbccf633c 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -344,7 +344,7 @@ init_expr_target (void) void init_expr (void) { - cfun->expr = ggc_alloc_cleared (sizeof (struct expr_status)); + memset (&rtl.expr, 0, sizeof (rtl.expr)); } /* Copy data from FROM to TO, where the machine modes are not the same. diff --git a/gcc/function.c b/gcc/function.c index 4e2da890214..325a205d827 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -193,8 +193,6 @@ struct temp_slot GTY(()) /* Forward declarations. */ -static rtx assign_stack_local_1 (enum machine_mode, HOST_WIDE_INT, int, - struct function *); static struct temp_slot *find_temp_slot_from_address (rtx); static void pad_to_arg_alignment (struct args_size *, int, struct args_size *); static void pad_below (struct args_size *, enum machine_mode, tree); @@ -315,45 +313,18 @@ free_after_compilation (struct function *f) VEC_free (int, heap, prologue); VEC_free (int, heap, epilogue); VEC_free (int, heap, sibcall_epilogue); + free (rtl.emit.regno_pointer_align); + memset (&rtl, 0, sizeof (rtl)); f->eh = NULL; - f->expr = NULL; - f->emit = NULL; - f->varasm = NULL; f->machine = NULL; f->cfg = NULL; - f->x_avail_temp_slots = NULL; - f->x_used_temp_slots = NULL; f->arg_offset_rtx = NULL; f->return_rtx = NULL; f->internal_arg_pointer = NULL; - f->x_nonlocal_goto_handler_labels = NULL; - f->x_return_label = NULL; - f->x_naked_return_label = NULL; - f->x_stack_slot_list = NULL; - f->x_stack_check_probe_note = NULL; - f->x_arg_pointer_save_area = NULL; - f->x_parm_birth_insn = NULL; - f->epilogue_delay_list = NULL; } -/* Allocate fixed slots in the stack frame of the current function. */ - -/* Return size needed for stack frame based on slots so far allocated in - function F. - This size counts from zero. It is not rounded to PREFERRED_STACK_BOUNDARY; - the caller may have to do that. */ - -static HOST_WIDE_INT -get_func_frame_size (struct function *f) -{ - if (FRAME_GROWS_DOWNWARD) - return -f->x_frame_offset; - else - return f->x_frame_offset; -} - /* Return size needed for stack frame based on slots so far allocated. This size counts from zero. It is not rounded to PREFERRED_STACK_BOUNDARY; the caller may have to do that. */ @@ -361,7 +332,10 @@ get_func_frame_size (struct function *f) HOST_WIDE_INT get_frame_size (void) { - return get_func_frame_size (cfun); + if (FRAME_GROWS_DOWNWARD) + return -frame_offset; + else + return frame_offset; } /* Issue an error message and return TRUE if frame OFFSET overflows in @@ -393,13 +367,10 @@ frame_offset_overflow (HOST_WIDE_INT offset, tree func) -2 means use BITS_PER_UNIT, positive specifies alignment boundary in bits. - We do not round to stack_boundary here. + We do not round to stack_boundary here. */ - FUNCTION specifies the function to allocate in. */ - -static rtx -assign_stack_local_1 (enum machine_mode mode, HOST_WIDE_INT size, int align, - struct function *function) +rtx +assign_stack_local (enum machine_mode mode, HOST_WIDE_INT size, int align) { rtx x, addr; int bigend_correction = 0; @@ -434,14 +405,14 @@ assign_stack_local_1 (enum machine_mode mode, HOST_WIDE_INT size, int align, alignment = align / BITS_PER_UNIT; if (FRAME_GROWS_DOWNWARD) - function->x_frame_offset -= size; + frame_offset -= size; /* Ignore alignment we can't do with expected alignment of the boundary. */ if (alignment * BITS_PER_UNIT > PREFERRED_STACK_BOUNDARY) alignment = PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT; - if (function->stack_alignment_needed < alignment * BITS_PER_UNIT) - function->stack_alignment_needed = alignment * BITS_PER_UNIT; + if (cfun->stack_alignment_needed < alignment * BITS_PER_UNIT) + cfun->stack_alignment_needed = alignment * BITS_PER_UNIT; /* Calculate how many bytes the start of local variables is off from stack alignment. */ @@ -461,13 +432,13 @@ assign_stack_local_1 (enum machine_mode mode, HOST_WIDE_INT size, int align, like. So we instead assume that ALIGNMENT is a power of two and use logical operations which are unambiguous. */ if (FRAME_GROWS_DOWNWARD) - function->x_frame_offset - = (FLOOR_ROUND (function->x_frame_offset - frame_phase, + frame_offset + = (FLOOR_ROUND (frame_offset - frame_phase, (unsigned HOST_WIDE_INT) alignment) + frame_phase); else - function->x_frame_offset - = (CEIL_ROUND (function->x_frame_offset - frame_phase, + frame_offset + = (CEIL_ROUND (frame_offset - frame_phase, (unsigned HOST_WIDE_INT) alignment) + frame_phase); } @@ -479,7 +450,7 @@ assign_stack_local_1 (enum machine_mode mode, HOST_WIDE_INT size, int align, /* If we have already instantiated virtual registers, return the actual address relative to the frame pointer. */ - if (function == cfun && virtuals_instantiated) + if (virtuals_instantiated) addr = plus_constant (frame_pointer_rtx, trunc_int_for_mode (frame_offset + bigend_correction @@ -487,33 +458,23 @@ assign_stack_local_1 (enum machine_mode mode, HOST_WIDE_INT size, int align, else addr = plus_constant (virtual_stack_vars_rtx, trunc_int_for_mode - (function->x_frame_offset + bigend_correction, + (frame_offset + bigend_correction, Pmode)); if (!FRAME_GROWS_DOWNWARD) - function->x_frame_offset += size; + frame_offset += size; x = gen_rtx_MEM (mode, addr); MEM_NOTRAP_P (x) = 1; - function->x_stack_slot_list - = gen_rtx_EXPR_LIST (VOIDmode, x, function->x_stack_slot_list); + stack_slot_list + = gen_rtx_EXPR_LIST (VOIDmode, x, stack_slot_list); - if (frame_offset_overflow (function->x_frame_offset, function->decl)) - function->x_frame_offset = 0; + if (frame_offset_overflow (frame_offset, current_function_decl)) + frame_offset = 0; return x; } - -/* Wrapper around assign_stack_local_1; assign a local stack slot for the - current function. */ - -rtx -assign_stack_local (enum machine_mode mode, HOST_WIDE_INT size, int align) -{ - return assign_stack_local_1 (mode, size, align, cfun); -} - /* Removes temporary slot TEMP from LIST. */ @@ -3975,7 +3936,7 @@ static void prepare_function_start (void) { init_emit (); - init_varasm_status (cfun); + init_varasm_status (); init_expr (); cse_not_expected = ! optimize; @@ -4440,7 +4401,7 @@ expand_function_end (void) /* If arg_pointer_save_area was referenced only from a nested function, we will not have initialized it yet. Do that now. */ if (arg_pointer_save_area && ! cfun->arg_pointer_save_area_init) - get_arg_pointer_save_area (cfun); + get_arg_pointer_save_area (); /* If we are doing stack checking and this function makes calls, do a stack probe at the start of the function to ensure we have enough @@ -4673,17 +4634,17 @@ expand_function_end (void) } rtx -get_arg_pointer_save_area (struct function *f) +get_arg_pointer_save_area (void) { - rtx ret = f->x_arg_pointer_save_area; + rtx ret = arg_pointer_save_area; if (! ret) { - ret = assign_stack_local_1 (Pmode, GET_MODE_SIZE (Pmode), 0, f); - f->x_arg_pointer_save_area = ret; + ret = assign_stack_local (Pmode, GET_MODE_SIZE (Pmode), 0); + arg_pointer_save_area = ret; } - if (f == cfun && ! f->arg_pointer_save_area_init) + if (! cfun->arg_pointer_save_area_init) { rtx seq; diff --git a/gcc/function.h b/gcc/function.h index fbaa17d0d47..6c95dcd1435 100644 --- a/gcc/function.h +++ b/gcc/function.h @@ -78,20 +78,22 @@ struct emit_status GTY(()) /* Indexed by pseudo register number, if nonzero gives the known alignment for that pseudo (if REG_POINTER is set in x_regno_reg_rtx). Allocated in parallel with x_regno_reg_rtx. */ - unsigned char * GTY ((length ("%h.x_reg_rtx_no"))) - regno_pointer_align; - - /* Indexed by pseudo register number, gives the rtx for that pseudo. - Allocated in parallel with regno_pointer_align. */ - rtx * GTY ((length ("%h.x_reg_rtx_no"))) x_regno_reg_rtx; + unsigned char * GTY((skip)) regno_pointer_align; }; + +/* Indexed by pseudo register number, gives the rtx for that pseudo. + Allocated in parallel with regno_pointer_align. + FIXME: We could put it into emit_status struct, but gengtype is not able to deal + with length attribute nested in top level structures. */ + +extern GTY ((length ("rtl.emit.x_reg_rtx_no"))) rtx * regno_reg_rtx; + /* For backward compatibility... eventually these should all go away. */ -#define reg_rtx_no (cfun->emit->x_reg_rtx_no) -#define regno_reg_rtx (cfun->emit->x_regno_reg_rtx) -#define seq_stack (cfun->emit->sequence_stack) +#define reg_rtx_no (rtl.emit.x_reg_rtx_no) +#define seq_stack (rtl.emit.sequence_stack) -#define REGNO_POINTER_ALIGN(REGNO) (cfun->emit->regno_pointer_align[REGNO]) +#define REGNO_POINTER_ALIGN(REGNO) (rtl.emit.regno_pointer_align[REGNO]) struct expr_status GTY(()) { @@ -134,12 +136,12 @@ struct expr_status GTY(()) rtx x_forced_labels; }; -#define pending_stack_adjust (cfun->expr->x_pending_stack_adjust) -#define inhibit_defer_pop (cfun->expr->x_inhibit_defer_pop) -#define saveregs_value (cfun->expr->x_saveregs_value) -#define apply_args_value (cfun->expr->x_apply_args_value) -#define forced_labels (cfun->expr->x_forced_labels) -#define stack_pointer_delta (cfun->expr->x_stack_pointer_delta) +#define pending_stack_adjust (rtl.expr.x_pending_stack_adjust) +#define inhibit_defer_pop (rtl.expr.x_inhibit_defer_pop) +#define saveregs_value (rtl.expr.x_saveregs_value) +#define apply_args_value (rtl.expr.x_apply_args_value) +#define forced_labels (rtl.expr.x_forced_labels) +#define stack_pointer_delta (rtl.expr.x_stack_pointer_delta) struct gimple_df; struct temp_slot; @@ -159,15 +161,91 @@ enum function_frequency { FUNCTION_FREQUENCY_HOT }; +struct varasm_status GTY(()) +{ + /* If we're using a per-function constant pool, this is it. */ + struct rtx_constant_pool *pool; + + /* Number of tree-constants deferred during the expansion of this + function. */ + unsigned int deferred_constants; +}; + +/* Datastructures maintained for currently processed function in RTL form. */ +struct rtl_data GTY(()) +{ + struct expr_status expr; + struct emit_status emit; + struct varasm_status varasm; + + /* List (chain of EXPR_LIST) of labels heading the current handlers for + nonlocal gotos. */ + rtx x_nonlocal_goto_handler_labels; + + /* Label that will go on function epilogue. + Jumping to this label serves as a "return" instruction + 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; + + /* List (chain of EXPR_LISTs) of all stack slots in this function. + Made for the sake of unshare_all_rtl. */ + rtx x_stack_slot_list; + + /* Place after which to insert the tail_recursion_label if we need one. */ + rtx x_stack_check_probe_note; + + /* Location at which to save the argument pointer if it will need to be + referenced. There are two cases where this is done: if nonlocal gotos + exist, or if vars stored at an offset from the argument pointer will be + needed by inner routines. */ + rtx x_arg_pointer_save_area; + + /* 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; + + /* Insn after which register parms and SAVE_EXPRs are born, if nonopt. */ + rtx x_parm_birth_insn; + + /* List of all used temporaries allocated, by level. */ + VEC(temp_slot_p,gc) *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; + + /* Highest label number in current function. */ + int inl_max_label_num; +}; + +#define return_label (rtl.x_return_label) +#define naked_return_label (rtl.x_naked_return_label) +#define stack_slot_list (rtl.x_stack_slot_list) +#define parm_birth_insn (rtl.x_parm_birth_insn) +#define frame_offset (rtl.x_frame_offset) +#define stack_check_probe_note (rtl.x_stack_check_probe_note) +#define arg_pointer_save_area (rtl.x_arg_pointer_save_area) +#define used_temp_slots (rtl.x_used_temp_slots) +#define avail_temp_slots (rtl.x_avail_temp_slots) +#define temp_slot_level (rtl.x_temp_slot_level) +#define nonlocal_goto_handler_labels (rtl.x_nonlocal_goto_handler_labels) + +extern GTY(()) struct rtl_data rtl; + /* This structure can save all the important global and static variables describing the status of the current function. */ struct function GTY(()) { struct eh_status *eh; - struct expr_status *expr; - struct emit_status *emit; - struct varasm_status *varasm; /* The control flow graph for this function. */ struct control_flow_graph *cfg; @@ -228,38 +306,6 @@ struct function GTY(()) has_hard_reg_initial_val (see integrate.[hc]). */ struct initial_value_struct *hard_reg_initial_vals; - /* List (chain of EXPR_LIST) of labels heading the current handlers for - nonlocal gotos. */ - rtx x_nonlocal_goto_handler_labels; - - /* Label that will go on function epilogue. - Jumping to this label serves as a "return" instruction - 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; - - /* List (chain of EXPR_LISTs) of all stack slots in this function. - Made for the sake of unshare_all_rtl. */ - rtx x_stack_slot_list; - - /* Place after which to insert the tail_recursion_label if we need one. */ - rtx x_stack_check_probe_note; - - /* Location at which to save the argument pointer if it will need to be - referenced. There are two cases where this is done: if nonlocal gotos - exist, or if vars stored at an offset from the argument pointer will be - needed by inner routines. */ - rtx x_arg_pointer_save_area; - - /* 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; - /* A PARM_DECL that should contain the static chain for this function. It will be initialized at the beginning of the function. */ tree static_chain_decl; @@ -269,21 +315,6 @@ struct function GTY(()) pointer. */ tree nonlocal_goto_save_area; - /* Insn after which register parms and SAVE_EXPRs are born, if nonopt. */ - rtx x_parm_birth_insn; - - /* List of all used temporaries allocated, by level. */ - VEC(temp_slot_p,gc) *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; - - /* Highest label number in current function. */ - int inl_max_label_num; - /* Function sequence number for profiling, debugging, etc. */ int funcdef_no; @@ -521,18 +552,6 @@ extern void instantiate_decl_rtl (rtx x); #define current_function_has_nonlocal_goto (cfun->has_nonlocal_goto) #define current_function_has_asm_statement (cfun->has_asm_statement) -#define return_label (cfun->x_return_label) -#define naked_return_label (cfun->x_naked_return_label) -#define stack_slot_list (cfun->x_stack_slot_list) -#define parm_birth_insn (cfun->x_parm_birth_insn) -#define frame_offset (cfun->x_frame_offset) -#define stack_check_probe_note (cfun->x_stack_check_probe_note) -#define arg_pointer_save_area (cfun->x_arg_pointer_save_area) -#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 nonlocal_goto_handler_labels (cfun->x_nonlocal_goto_handler_labels) -#define rtl_df (cfun->df) #define current_loops (cfun->x_current_loops) #define dom_computed (cfun->cfg->x_dom_computed) #define n_bbs_in_dom_tree (cfun->cfg->x_n_bbs_in_dom_tree) @@ -570,14 +589,14 @@ extern struct machine_function * (*init_machine_status) (void); extern void free_after_parsing (struct function *); extern void free_after_compilation (struct function *); -extern void init_varasm_status (struct function *); +extern void init_varasm_status (void); #ifdef RTX_CODE extern void diddle_return_value (void (*)(rtx, void*), void*); extern void clobber_return_register (void); #endif -extern rtx get_arg_pointer_save_area (struct function *); +extern rtx get_arg_pointer_save_area (void); /* Returns the name of the current function. */ extern const char *current_function_name (void); diff --git a/gcc/stmt.c b/gcc/stmt.c index aacb1840dec..35ba37b1c26 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -160,8 +160,7 @@ force_label_rtx (tree label) else p = cfun; - p->expr->x_forced_labels = gen_rtx_EXPR_LIST (VOIDmode, ref, - p->expr->x_forced_labels); + forced_labels = gen_rtx_EXPR_LIST (VOIDmode, ref, forced_labels); return ref; } @@ -1821,7 +1820,7 @@ expand_nl_goto_receiver (void) /* Now restore our arg pointer from the address at which it was saved in our stack frame. */ emit_move_insn (virtual_incoming_args_rtx, - copy_to_reg (get_arg_pointer_save_area (cfun))); + copy_to_reg (get_arg_pointer_save_area ())); } } #endif diff --git a/gcc/varasm.c b/gcc/varasm.c index b4ff7fe2fad..f4607b49eea 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -70,17 +70,7 @@ struct addr_const; struct constant_descriptor_rtx; struct rtx_constant_pool; -struct varasm_status GTY(()) -{ - /* If we're using a per-function constant pool, this is it. */ - struct rtx_constant_pool *pool; - - /* Number of tree-constants deferred during the expansion of this - function. */ - unsigned int deferred_constants; -}; - -#define n_deferred_constants (cfun->varasm->deferred_constants) +#define n_deferred_constants (rtl.varasm.deferred_constants) /* Number for making the label on the next constant that is stored in memory. */ @@ -3464,15 +3454,10 @@ create_constant_pool (void) /* Initialize constant pool hashing for a new function. */ void -init_varasm_status (struct function *f) +init_varasm_status (void) { - struct varasm_status *p; - - p = ggc_alloc (sizeof (struct varasm_status)); - f->varasm = p; - - p->pool = create_constant_pool (); - p->deferred_constants = 0; + rtl.varasm.pool = create_constant_pool (); + rtl.varasm.deferred_constants = 0; } /* Given a MINUS expression, simplify it if both sides @@ -3509,7 +3494,7 @@ force_const_mem (enum machine_mode mode, rtx x) /* Decide which pool to use. */ pool = (targetm.use_blocks_for_constant_p (mode, x) ? shared_constant_pool - : cfun->varasm->pool); + : rtl.varasm.pool); /* Lookup the value in the hashtable. */ tmp.constant = x; @@ -3621,7 +3606,7 @@ get_pool_mode (const_rtx addr) int get_pool_size (void) { - return cfun->varasm->pool->offset; + return rtl.varasm.pool->offset; } /* Worker function for output_constant_pool_1. Emit assembly for X @@ -3863,7 +3848,7 @@ static void output_constant_pool (const char *fnname ATTRIBUTE_UNUSED, tree fndecl ATTRIBUTE_UNUSED) { - struct rtx_constant_pool *pool = cfun->varasm->pool; + struct rtx_constant_pool *pool = rtl.varasm.pool; /* It is possible for gcc to call force_const_mem and then to later discard the instructions which refer to the constant. In such a -- 2.30.2