From 2b8088e7c8f383aaec2391f8a8da4e1c1559e4fc Mon Sep 17 00:00:00 2001 From: Chung-Lin Tang Date: Tue, 12 Jun 2012 06:11:09 +0000 Subject: [PATCH] sh.c (output_stack_adjust): Remove !epilogue_p condition for generating REG_FRAME_RELATED_EXPR note. 2012-06-12 Chung-Lin Tang * 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 | 9 +++++++++ gcc/config/sh/sh.c | 30 ++++++++++++++++++++---------- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6576c6b5ec3..c2e212c42fd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2012-06-12 Chung-Lin Tang + + * 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 * config/alpha/alpha.c (HWI_HEX2): Add missing shift. diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index 91c229936ec..4c6b9cf7af7 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -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, -- 2.30.2