arm.c (arm_compute_initial_elimination_offset): If optimizing for size...
authorRichard Earnshaw <rearnsha@arm.com>
Thu, 30 Jan 2003 15:39:43 +0000 (15:39 +0000)
committerRichard Earnshaw <rearnsha@gcc.gnu.org>
Thu, 30 Jan 2003 15:39:43 +0000 (15:39 +0000)
* arm.c (arm_compute_initial_elimination_offset): If optimizing for
size, the link register is always saved if any other register is
saved.

From-SVN: r62142

gcc/ChangeLog
gcc/config/arm/arm.c

index 8ba5264180ccaaf5e29fddaa68ad320a73d5ee22..4e7b7e8e17fe1e18dd158eb218fadc02415b59b9 100644 (file)
@@ -1,3 +1,9 @@
+2003-01-30  Richard Earnshaw  <rearnsha@arm.com>
+
+       * arm.c (arm_compute_initial_elimination_offset): If optimizing for
+       size, the link register is always saved if any other register is
+       saved.
+
 2003-01-30  Kazu Hirata  <kazu@cs.umass.edu>
 
        * config/h8300/h8300-protos.h: Update the prototype for
index 20ae69725a6e8fea01a080977c12ed6354b17472..3a8d993af461ca00aefc4b7d93c4e701fd545327 100644 (file)
@@ -8648,10 +8648,14 @@ arm_compute_initial_elimination_offset (from, to)
          reg_mask = reg_mask & ~ (reg_mask & - reg_mask);
        }
 
-      if (regs_ever_live[LR_REGNUM]
-         /* If a stack frame is going to be created, the LR will
-            be saved as part of that, so we do not need to allow
-            for it here.  */
+      if ((regs_ever_live[LR_REGNUM]
+          /* If optimizing for size, then we save the link register if
+             any other integer register is saved.  This gives a smaller
+             return sequence.  */
+          || (optimize_size && call_saved_registers > 0))
+         /* But if a stack frame is going to be created, the LR will
+            be saved as part of that, so we do not need to allow for
+            it here.  */
          && ! frame_pointer_needed)
        call_saved_registers += 4;