From c8ad18edf9c33055cc47034922ff0703082bf154 Mon Sep 17 00:00:00 2001 From: cltang Date: Tue, 12 Jun 2012 06:11:09 +0000 Subject: [PATCH] 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'. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@188424 138bc75d-0d04-0410-961f-82ee72b054a4 --- 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 6576c6b..c2e212c 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 91c2299..4c6b9cf 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.7.4