Commit 16dc5c28 by Richard Sandiford Committed by Richard Sandiford

mips-protos.h (compute_frame_size): Delete.

gcc/
	* config/mips/mips-protos.h (compute_frame_size): Delete.
	* config/mips/mips.h: Update comments.
	* config/mips/mips.c (mips_frame_info): Remove initialized.
	(compute_frame_size): Rename to...
	(mips_compute_frame_info): ...this and make static.  Remove the
	SIZE argument and return no value.  Remove the setting of initialized.
	Update rest of file accordingly.
	(mips_set_return_address): Don't call compute_frame_size.
	(mips_can_use_return_insn): Don't check df_regs_ever_live_p (31).
	Don't call compute_frame_size.

From-SVN: r129460
parent 29c4d304
2007-10-18 Richard Sandiford <rsandifo@nildram.co.uk> 2007-10-18 Richard Sandiford <rsandifo@nildram.co.uk>
* config/mips/mips-protos.h (compute_frame_size): Delete.
* config/mips/mips.h: Update comments.
* config/mips/mips.c (mips_frame_info): Remove initialized.
(compute_frame_size): Rename to...
(mips_compute_frame_info): ...this and make static. Remove the
SIZE argument and return no value. Remove the setting of initialized.
Update rest of file accordingly.
(mips_set_return_address): Don't call compute_frame_size.
(mips_can_use_return_insn): Don't check df_regs_ever_live_p (31).
Don't call compute_frame_size.
2007-10-18 Richard Sandiford <rsandifo@nildram.co.uk>
* config/mips/mips-protos.h (mips_frame_pointer_required): Declare. * config/mips/mips-protos.h (mips_frame_pointer_required): Declare.
* config/mips/mips.h (FRAME_POINTER_REQUIRED): Use * config/mips/mips.h (FRAME_POINTER_REQUIRED): Use
mips_hard_frame_pointer_required. mips_hard_frame_pointer_required.
...@@ -256,7 +256,6 @@ extern void mips_finish_declare_object (FILE *, tree, int, int); ...@@ -256,7 +256,6 @@ extern void mips_finish_declare_object (FILE *, tree, int, int);
extern bool mips_small_data_pattern_p (rtx); extern bool mips_small_data_pattern_p (rtx);
extern rtx mips_rewrite_small_data (rtx); extern rtx mips_rewrite_small_data (rtx);
extern bool mips_frame_pointer_required (void); extern bool mips_frame_pointer_required (void);
extern HOST_WIDE_INT compute_frame_size (HOST_WIDE_INT);
extern HOST_WIDE_INT mips_initial_elimination_offset (int, int); extern HOST_WIDE_INT mips_initial_elimination_offset (int, int);
extern rtx mips_return_addr (int, rtx); extern rtx mips_return_addr (int, rtx);
extern enum mips_loadgp_style mips_current_loadgp_style (void); extern enum mips_loadgp_style mips_current_loadgp_style (void);
......
...@@ -234,9 +234,7 @@ static const char *const mips_fp_conditions[] = { ...@@ -234,9 +234,7 @@ static const char *const mips_fp_conditions[] = {
MIPS_FP_CONDITIONS (STRINGIFY) MIPS_FP_CONDITIONS (STRINGIFY)
}; };
/* Structure to be filled in by compute_frame_size with register /* Information about a function's frame layout. */
save masks, and offsets for the current function. */
struct mips_frame_info GTY(()) struct mips_frame_info GTY(())
{ {
/* The size of the frame in bytes. */ /* The size of the frame in bytes. */
...@@ -280,9 +278,6 @@ struct mips_frame_info GTY(()) ...@@ -280,9 +278,6 @@ struct mips_frame_info GTY(())
/* The offset of hard_frame_pointer_rtx from frame_pointer_rtx. */ /* The offset of hard_frame_pointer_rtx from frame_pointer_rtx. */
HOST_WIDE_INT hard_frame_pointer_offset; HOST_WIDE_INT hard_frame_pointer_offset;
/* True if this structure has been initialized after reload. */
bool initialized;
}; };
struct machine_function GTY(()) { struct machine_function GTY(()) {
...@@ -294,7 +289,7 @@ struct machine_function GTY(()) { ...@@ -294,7 +289,7 @@ struct machine_function GTY(()) {
This area is allocated by the callee at the very top of the frame. */ This area is allocated by the callee at the very top of the frame. */
int varargs_size; int varargs_size;
/* Current frame information, calculated by compute_frame_size. */ /* Current frame information, calculated by mips_compute_frame_info. */
struct mips_frame_info frame; struct mips_frame_info frame;
/* The register to use as the global pointer within this function. */ /* The register to use as the global pointer within this function. */
...@@ -7833,8 +7828,7 @@ mips_save_reg_p (unsigned int regno) ...@@ -7833,8 +7828,7 @@ mips_save_reg_p (unsigned int regno)
return false; return false;
} }
/* Return the bytes needed to compute the frame pointer from the current /* Populate the current function's mips_frame_info structure.
stack pointer. SIZE is the size (in bytes) of the local variables.
MIPS stack frames look like: MIPS stack frames look like:
...@@ -7895,15 +7889,16 @@ mips_save_reg_p (unsigned int regno) ...@@ -7895,15 +7889,16 @@ mips_save_reg_p (unsigned int regno)
They decrease stack_pointer_rtx but leave frame_pointer_rtx and They decrease stack_pointer_rtx but leave frame_pointer_rtx and
hard_frame_pointer_rtx unchanged. */ hard_frame_pointer_rtx unchanged. */
HOST_WIDE_INT static void
compute_frame_size (HOST_WIDE_INT size) mips_compute_frame_info (void)
{ {
struct mips_frame_info *frame; struct mips_frame_info *frame;
HOST_WIDE_INT offset; HOST_WIDE_INT offset, size;
unsigned int regno, i; unsigned int regno, i;
frame = &cfun->machine->frame; frame = &cfun->machine->frame;
memset (frame, 0, sizeof (*frame)); memset (frame, 0, sizeof (*frame));
size = get_frame_size ();
cfun->machine->global_pointer = mips_global_pointer (); cfun->machine->global_pointer = mips_global_pointer ();
...@@ -8007,9 +8002,6 @@ compute_frame_size (HOST_WIDE_INT size) ...@@ -8007,9 +8002,6 @@ compute_frame_size (HOST_WIDE_INT size)
instructions for local variables and incoming arguments. */ instructions for local variables and incoming arguments. */
if (TARGET_MIPS16) if (TARGET_MIPS16)
frame->hard_frame_pointer_offset = frame->args_size; frame->hard_frame_pointer_offset = frame->args_size;
frame->initialized = reload_completed;
return frame->total_size;
} }
/* Return the style of GP load sequence that is being used for the /* Return the style of GP load sequence that is being used for the
...@@ -8046,7 +8038,7 @@ mips_frame_pointer_required (void) ...@@ -8046,7 +8038,7 @@ mips_frame_pointer_required (void)
without using a second temporary register. */ without using a second temporary register. */
if (TARGET_MIPS16) if (TARGET_MIPS16)
{ {
compute_frame_size (get_frame_size ()); mips_compute_frame_info ();
if (!SMALL_OPERAND (cfun->machine->frame.total_size)) if (!SMALL_OPERAND (cfun->machine->frame.total_size))
return true; return true;
} }
...@@ -8063,7 +8055,7 @@ mips_initial_elimination_offset (int from, int to) ...@@ -8063,7 +8055,7 @@ mips_initial_elimination_offset (int from, int to)
{ {
HOST_WIDE_INT offset; HOST_WIDE_INT offset;
compute_frame_size (get_frame_size ()); mips_compute_frame_info ();
/* Set OFFSET to the offset from the soft frame pointer, which is also /* Set OFFSET to the offset from the soft frame pointer, which is also
the offset from the end-of-prologue stack pointer. */ the offset from the end-of-prologue stack pointer. */
...@@ -8118,7 +8110,6 @@ mips_set_return_address (rtx address, rtx scratch) ...@@ -8118,7 +8110,6 @@ mips_set_return_address (rtx address, rtx scratch)
{ {
rtx slot_address; rtx slot_address;
compute_frame_size (get_frame_size ());
gcc_assert ((cfun->machine->frame.mask >> 31) & 1); gcc_assert ((cfun->machine->frame.mask >> 31) & 1);
slot_address = mips_add_offset (scratch, stack_pointer_rtx, slot_address = mips_add_offset (scratch, stack_pointer_rtx,
cfun->machine->frame.gp_sp_offset); cfun->machine->frame.gp_sp_offset);
...@@ -8192,7 +8183,7 @@ mips_for_each_saved_reg (HOST_WIDE_INT sp_offset, mips_save_restore_fn fn) ...@@ -8192,7 +8183,7 @@ mips_for_each_saved_reg (HOST_WIDE_INT sp_offset, mips_save_restore_fn fn)
} }
/* This loop must iterate over the same space as its companion in /* This loop must iterate over the same space as its companion in
compute_frame_size. */ mips_compute_frame_info. */
offset = cfun->machine->frame.fp_sp_offset - sp_offset; offset = cfun->machine->frame.fp_sp_offset - sp_offset;
fpr_mode = (TARGET_SINGLE_FLOAT ? SFmode : DFmode); fpr_mode = (TARGET_SINGLE_FLOAT ? SFmode : DFmode);
for (regno = (FP_REG_LAST - MAX_FPRS_PER_FMT + 1); for (regno = (FP_REG_LAST - MAX_FPRS_PER_FMT + 1);
...@@ -8447,7 +8438,7 @@ mips_expand_prologue (void) ...@@ -8447,7 +8438,7 @@ mips_expand_prologue (void)
if (cfun->machine->global_pointer > 0) if (cfun->machine->global_pointer > 0)
SET_REGNO (pic_offset_table_rtx, cfun->machine->global_pointer); SET_REGNO (pic_offset_table_rtx, cfun->machine->global_pointer);
size = compute_frame_size (get_frame_size ()); size = cfun->machine->frame.total_size;
/* Save the registers. Allocate up to MIPS_MAX_FIRST_STACK_STEP /* Save the registers. Allocate up to MIPS_MAX_FIRST_STACK_STEP
bytes beforehand; this is enough to cover the register save area bytes beforehand; this is enough to cover the register save area
...@@ -8768,7 +8759,7 @@ mips_can_use_return_insn (void) ...@@ -8768,7 +8759,7 @@ mips_can_use_return_insn (void)
if (! reload_completed) if (! reload_completed)
return 0; return 0;
if (df_regs_ever_live_p (31) || current_function_profile) if (current_function_profile)
return 0; return 0;
/* In mips16 mode, a function that returns a floating point value /* In mips16 mode, a function that returns a floating point value
...@@ -8777,10 +8768,7 @@ mips_can_use_return_insn (void) ...@@ -8777,10 +8768,7 @@ mips_can_use_return_insn (void)
if (mips16_cfun_returns_in_fpr_p ()) if (mips16_cfun_returns_in_fpr_p ())
return 0; return 0;
if (cfun->machine->frame.initialized) return cfun->machine->frame.total_size == 0;
return cfun->machine->frame.total_size == 0;
return compute_frame_size (get_frame_size ()) == 0;
} }
/* Implement HARD_REGNO_NREGS. The size of FP registers is controlled /* Implement HARD_REGNO_NREGS. The size of FP registers is controlled
......
...@@ -1881,7 +1881,7 @@ enum reg_class ...@@ -1881,7 +1881,7 @@ enum reg_class
#define STACK_GROWS_DOWNWARD #define STACK_GROWS_DOWNWARD
/* The offset of the first local variable from the beginning of the frame. /* The offset of the first local variable from the beginning of the frame.
See compute_frame_size for details about the frame layout. */ See mips_compute_frame_info for details about the frame layout. */
#define STARTING_FRAME_OFFSET \ #define STARTING_FRAME_OFFSET \
(current_function_outgoing_args_size \ (current_function_outgoing_args_size \
......
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