]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/31701 (SH: wrong epilogue for sibling calls)
authorKaz Kojima <kkojima@gcc.gnu.org>
Sun, 20 May 2007 23:57:32 +0000 (23:57 +0000)
committerKaz Kojima <kkojima@gcc.gnu.org>
Sun, 20 May 2007 23:57:32 +0000 (23:57 +0000)
PR target/31701
Backport from mainline.
* config/sh/sh.c (output_stack_adjust): Avoid using the frame
register itself to hold the offset constant.  Tell flow the use
of r4 and r5 when they are used.

From-SVN: r124885

gcc/ChangeLog
gcc/config/sh/sh.c

index ef1d1d15187a530362242666ed6135bcdaf1889c..9c23510d75b21b96b1cb7a2c87345d2d894df205 100644 (file)
@@ -1,3 +1,11 @@
+2007-05-20  Kaz Kojima  <kkojima@gcc.gnu.org>
+
+       PR target/31701
+       Backport from mainline.
+       * config/sh/sh.c (output_stack_adjust): Avoid using the frame
+       register itself to hold the offset constant.  Tell flow the use
+       of r4 and r5 when they are used.
+
 2007-05-20  Kaz Kojima  <kkojima@gcc.gnu.org>
 
        PR target/31480
index 5b9ab5cdab655635f9a5fa8e8ec7b3cde155da0f..df9e146ba7f9919e2a3f7098ca03198cf312ebda 100644 (file)
@@ -5154,7 +5154,13 @@ output_stack_adjust (int size, rtx reg, int epilogue_p,
              temp = scavenge_reg (&temps);
            }
          if (temp < 0 && live_regs_mask)
-           temp = scavenge_reg (live_regs_mask);
+           {
+             HARD_REG_SET temps;
+
+             COPY_HARD_REG_SET (temps, *live_regs_mask);
+             CLEAR_HARD_REG_BIT (temps, REGNO (reg));
+             temp = scavenge_reg (&temps);
+           }
          if (temp < 0)
            {
              rtx adj_reg, tmp_reg, mem;
@@ -5203,6 +5209,9 @@ output_stack_adjust (int size, rtx reg, int epilogue_p,
              emit_move_insn (adj_reg, mem);
              mem = gen_tmp_stack_mem (Pmode, gen_rtx_POST_INC (Pmode, reg));
              emit_move_insn (tmp_reg, mem);
+             /* Tell flow the insns that pop r4/r5 aren't dead.  */
+             emit_insn (gen_rtx_USE (VOIDmode, tmp_reg));
+             emit_insn (gen_rtx_USE (VOIDmode, adj_reg));
              return;
            }
          const_reg = gen_rtx_REG (GET_MODE (reg), temp);