sh.c (output_stack_adjust): Remove !epilogue_p condition for generating REG_FRAME_REL...
authorChung-Lin Tang <cltang@codesourcery.com>
Tue, 12 Jun 2012 06:11:09 +0000 (06:11 +0000)
committerChung-Lin Tang <cltang@gcc.gnu.org>
Tue, 12 Jun 2012 06:11:09 +0000 (06:11 +0000)
2012-06-12  Chung-Lin Tang  <cltang@codesourcery.com>

* config/sh/sh.c (output_stack_adjust): Remove !epilogue_p
condition for generating REG_FRAME_RELATED_EXPR note.
(pop): Add code for generating REG_CFA_RESTORE,
REG_CFA_ADJUST_CFA notes. Set RTX_FRAME_RELATED_P to 1.
(sh_expand_epilogue): Use frame_insn() for FP to SP move.
Set 'frame_p' of calls to output_stack_adjust() to 'true'.

From-SVN: r188424

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

index 6576c6b5ec3ba2c455cfdcbb9641340d91f2f441..c2e212c42fd905a4ea0199dc2e62fc9844e23bd3 100644 (file)
@@ -1,3 +1,12 @@
+2012-06-12  Chung-Lin Tang  <cltang@codesourcery.com>
+
+       * config/sh/sh.c (output_stack_adjust): Remove !epilogue_p
+       condition for generating REG_FRAME_RELATED_EXPR note.
+       (pop): Add code for generating REG_CFA_RESTORE,
+       REG_CFA_ADJUST_CFA notes. Set RTX_FRAME_RELATED_P to 1.
+       (sh_expand_epilogue): Use frame_insn() for FP to SP move.
+       Set 'frame_p' of calls to output_stack_adjust() to 'true'.
+
 2012-06-11  Richard Henderson  <rth@redhat.com>
 
        * config/alpha/alpha.c (HWI_HEX2): Add missing shift.
index 91c229936ec917cd5ea8e588812cd31a7d9e7b0f..4c6b9cf7af7c121d6853e703ebf0241cf95f8c1b 100644 (file)
@@ -6483,11 +6483,10 @@ output_stack_adjust (int size, rtx reg, int epilogue_p,
              emit_insn (GEN_MOV (const_reg, GEN_INT (size)));
              insn = emit_fn (GEN_ADD3 (reg, reg, const_reg));
            }
-         if (! epilogue_p)
-           add_reg_note (insn, REG_FRAME_RELATED_EXPR,
-                         gen_rtx_SET (VOIDmode, reg,
-                                      gen_rtx_PLUS (SImode, reg,
-                                                    GEN_INT (size))));
+         add_reg_note (insn, REG_FRAME_RELATED_EXPR,
+                       gen_rtx_SET (VOIDmode, reg,
+                                    gen_rtx_PLUS (SImode, reg,
+                                                  GEN_INT (size))));
        }
     }
 }
@@ -6532,7 +6531,7 @@ push (int rn)
 static void
 pop (int rn)
 {
-  rtx x;
+  rtx x, sp_reg, reg;
   if (rn == FPUL_REG)
     x = gen_pop_fpul ();
   else if (rn == FPSCR_REG)
@@ -6550,7 +6549,18 @@ pop (int rn)
     x = gen_pop (gen_rtx_REG (SImode, rn));
 
   x = emit_insn (x);
+
+  sp_reg = gen_rtx_REG (SImode, STACK_POINTER_REGNUM);
+  reg = copy_rtx (GET_CODE (PATTERN (x)) == PARALLEL
+                 ? SET_DEST (XVECEXP (PATTERN (x), 0, 0))
+                 : SET_DEST (PATTERN (x)));
+  add_reg_note (x, REG_CFA_RESTORE, reg);
+  add_reg_note (x, REG_CFA_ADJUST_CFA,
+               gen_rtx_SET (SImode, sp_reg,
+                            plus_constant (SImode, sp_reg,
+                                           GET_MODE_SIZE (GET_MODE (reg)))));
   add_reg_note (x, REG_INC, gen_rtx_REG (SImode, STACK_POINTER_REGNUM));
+  RTX_FRAME_RELATED_P (x) = 1;
 }
 
 /* Generate code to push the regs specified in the mask.  */
@@ -7433,14 +7443,14 @@ sh_expand_epilogue (bool sibcall_p)
         See PR/18032 and PR/40313.  */
       emit_insn (gen_blockage ());
       output_stack_adjust (frame_size, hard_frame_pointer_rtx, e,
-                          &live_regs_mask, false);
+                          &live_regs_mask, true);
 
       /* We must avoid moving the stack pointer adjustment past code
         which reads from the local frame, else an interrupt could
         occur after the SP adjustment and clobber data in the local
         frame.  */
       emit_insn (gen_blockage ());
-      emit_insn (GEN_MOV (stack_pointer_rtx, hard_frame_pointer_rtx));
+      frame_insn (GEN_MOV (stack_pointer_rtx, hard_frame_pointer_rtx));
     }
   else if (frame_size)
     {
@@ -7450,7 +7460,7 @@ sh_expand_epilogue (bool sibcall_p)
         frame.  */
       emit_insn (gen_blockage ());
       output_stack_adjust (frame_size, stack_pointer_rtx, e,
-                          &live_regs_mask, false);
+                          &live_regs_mask, true);
     }
 
   if (SHMEDIA_REGS_STACK_ADJUST ())
@@ -7667,7 +7677,7 @@ sh_expand_epilogue (bool sibcall_p)
   output_stack_adjust (crtl->args.pretend_args_size
                       + save_size + d_rounding
                       + crtl->args.info.stack_regs * 8,
-                      stack_pointer_rtx, e, NULL, false);
+                      stack_pointer_rtx, e, NULL, true);
 
   if (crtl->calls_eh_return)
     emit_insn (GEN_ADD3 (stack_pointer_rtx, stack_pointer_rtx,