diff options
author | Jan Hubicka <jh@suse.cz> | 2008-03-31 19:08:31 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2008-03-31 17:08:31 +0000 |
commit | bd60bab2ad76a635640db0101275111be8b04987 (patch) | |
tree | 484f1e4819fe26e37e4e3754778504623c82e3b4 /gcc/function.c | |
parent | 2566855a60b790dd23a7375319e7dc0ec7886cee (diff) | |
download | gcc-bd60bab2ad76a635640db0101275111be8b04987.zip gcc-bd60bab2ad76a635640db0101275111be8b04987.tar.gz gcc-bd60bab2ad76a635640db0101275111be8b04987.tar.bz2 |
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
Diffstat (limited to 'gcc/function.c')
-rw-r--r-- | gcc/function.c | 99 |
1 files changed, 30 insertions, 69 deletions
diff --git a/gcc/function.c b/gcc/function.c index 4e2da89..325a205 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; |