arm.c (thumb1_compute_save_reg_mask): Make sure scratch reg does not overlap return...
authorPaul Brook <paul@codesourcery.com>
Thu, 12 Jul 2007 21:28:27 +0000 (21:28 +0000)
committerPaul Brook <pbrook@gcc.gnu.org>
Thu, 12 Jul 2007 21:28:27 +0000 (21:28 +0000)
2007-07-12  Paul Brook  <paul@codesourcery.com>

gcc/
* config/arm/arm.c (thumb1_compute_save_reg_mask): Make sure scratch
reg does not overlap return value.

From-SVN: r126604

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

index 8502ba0d0218b6a62e87cec7798cf0b086aa4ab9..806a0579736c78d7c6c095383881ce0a5f1fa0e0 100644 (file)
@@ -1,3 +1,8 @@
+2007-07-12  Paul Brook  <paul@codesourcery.com>
+
+       * config/arm/arm.c (thumb1_compute_save_reg_mask): Make sure scratch
+       reg does not overlap return value.
+
 2007-07-12  Daniel Berlin  <dberlin@dberlin.org>
 
        * tree-ssa-pre.c (get_expression_vuses): Move out side-effect.
index 6e9937102277b4b6c771a01e9dce2fa564e7d112..5569d4a615b742fcc6f15bfdb0f7059cbde23de8 100644 (file)
@@ -10182,6 +10182,10 @@ thumb1_compute_save_reg_mask (void)
         have to push it.  Use LAST_LO_REGNUM as our fallback
         choice for the register to select.  */
       reg = thumb_find_work_register (1 << LAST_LO_REGNUM);
+      /* Make sure the register returned by thumb_find_work_register is
+        not part of the return value.  */
+      if (reg * UNITS_PER_WORD <= arm_size_return_regs ())
+       reg = LAST_LO_REGNUM;
 
       if (! call_used_regs[reg])
        mask |= 1 << reg;