mips.c (compute_frame_size): Restore the original gp_sp_offset for !GENERATE_MIPS16E_...
authorRichard Sandiford <richard@codesourcery.com>
Fri, 6 Jul 2007 09:27:10 +0000 (09:27 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Fri, 6 Jul 2007 09:27:10 +0000 (09:27 +0000)
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.

From-SVN: r126406

gcc/ChangeLog
gcc/config/mips/mips.c

index 6d5d1c16d4fbd5fbe98fa791d4c94ced046b2be5..3d7ac29448537b01b0bc3d3db13eab5ec9ba87fd 100644 (file)
@@ -1,3 +1,10 @@
+2007-07-06  Richard Sandiford  <richard@codesourcery.com>
+
+       * 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  <rguenther@suse.de>
 
        * c-common.c (boolean_increment): Use correctly typed
index 8c7b70c2485f8c4a3156e90dba30d066a57b94ba..980c928a10f8d36911966a21426af3ffbc336ba9 100644 (file)
@@ -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;
     }