From f999f5d0de4400c2626a9ef3c321ea071edeee76 Mon Sep 17 00:00:00 2001 From: rsandifo Date: Fri, 6 Jul 2007 09:27:10 +0000 Subject: [PATCH] gcc/ * config/mips/mips.c (compute_frame_size): Restore the original gp_sp_offset for !GENERATE_MIPS16E_SAVE_RESTORE and remove the fp_size term from the GENERATE_MIPS16E_SAVE_RESTORE calculation. Document why the difference is needed. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@126406 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/config/mips/mips.c | 16 ++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6d5d1c1..3d7ac29 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2007-07-06 Richard Sandiford + + * config/mips/mips.c (compute_frame_size): Restore the original + gp_sp_offset for !GENERATE_MIPS16E_SAVE_RESTORE and remove the + fp_size term from the GENERATE_MIPS16E_SAVE_RESTORE calculation. + Document why the difference is needed. + 2007-07-06 Richard Guenther * c-common.c (boolean_increment): Use correctly typed diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 8c7b70c..980c928 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -6781,12 +6781,16 @@ compute_frame_size (HOST_WIDE_INT size) { HOST_WIDE_INT offset; - /* MIPS16e SAVE and RESTORE instructions require the GP save area - to be aligned at the high end with any padding at the low end, - so do it that way all the time. */ - offset = (total_size - - MIPS_STACK_ALIGN (fp_reg_size) - - GET_MODE_SIZE (gpr_mode)); + if (GENERATE_MIPS16E_SAVE_RESTORE) + /* MIPS16e SAVE and RESTORE instructions require the GP save area + to be aligned at the high end with any padding at the low end. + It is only safe to use this calculation for o32, where we never + have pretend arguments, and where any varargs will be saved in + the caller-allocated area rather than at the top of the frame. */ + offset = (total_size - GET_MODE_SIZE (gpr_mode)); + else + offset = (args_size + cprestore_size + var_size + + gp_reg_size - GET_MODE_SIZE (gpr_mode)); cfun->machine->frame.gp_sp_offset = offset; cfun->machine->frame.gp_save_offset = offset - total_size; } -- 2.7.4