Commit 0621cf3c by Richard Sandiford Committed by Richard Sandiford

s390.c (s390_restore_gprs_from_fprs): Add REG_CFA_RESTORE notes to each restore.

gcc/
	* config/s390/s390.c (s390_restore_gprs_from_fprs): Add REG_CFA_RESTORE
	notes to each restore.  Also add REG_CFA_DEF_CFA when restoring %r15.
	(s390_optimize_prologue): Don't clear RTX_FRAME_RELATED_P.  Update the
	REG_CFA_RESTORE list when deciding not to restore a register.

From-SVN: r207604
parent 4099494d
2014-02-07 Richard Sandiford <rsandifo@linux.vnet.ibm.com> 2014-02-07 Richard Sandiford <rsandifo@linux.vnet.ibm.com>
* config/s390/s390.c (s390_restore_gprs_from_fprs): Add REG_CFA_RESTORE
notes to each restore. Also add REG_CFA_DEF_CFA when restoring %r15.
(s390_optimize_prologue): Don't clear RTX_FRAME_RELATED_P. Update the
REG_CFA_RESTORE list when deciding not to restore a register.
2014-02-07 Richard Sandiford <rsandifo@linux.vnet.ibm.com>
* config/s390/s390.c: Include tree-pass.h and context.h. * config/s390/s390.c: Include tree-pass.h and context.h.
(s390_early_mach): New function, split out from... (s390_early_mach): New function, split out from...
(s390_emit_prologue): ...here. (s390_emit_prologue): ...here.
......
...@@ -8610,11 +8610,11 @@ s390_restore_gprs_from_fprs (void) ...@@ -8610,11 +8610,11 @@ s390_restore_gprs_from_fprs (void)
emit_move_insn (gen_rtx_REG (DImode, i), emit_move_insn (gen_rtx_REG (DImode, i),
gen_rtx_REG (DImode, cfun_gpr_save_slot (i))); gen_rtx_REG (DImode, cfun_gpr_save_slot (i)));
df_set_regs_ever_live (i, true); df_set_regs_ever_live (i, true);
/* The frame related flag is only required on the save add_reg_note (insn, REG_CFA_RESTORE, gen_rtx_REG (DImode, i));
operations. We nevertheless set it also for the restore if (i == STACK_POINTER_REGNUM)
in order to recognize these instructions in add_reg_note (insn, REG_CFA_DEF_CFA,
s390_optimize_prologue. The flag will then be plus_constant (Pmode, stack_pointer_rtx,
deleted. */ STACK_POINTER_OFFSET));
RTX_FRAME_RELATED_P (insn) = 1; RTX_FRAME_RELATED_P (insn) = 1;
} }
} }
...@@ -10854,12 +10854,6 @@ s390_optimize_prologue (void) ...@@ -10854,12 +10854,6 @@ s390_optimize_prologue (void)
|| call_really_used_regs[gpr_regno]) || call_really_used_regs[gpr_regno])
continue; continue;
/* For restores we have to revert the frame related flag
since no debug info is supposed to be generated for
these. */
if (dest_regno == gpr_regno)
RTX_FRAME_RELATED_P (insn) = 0;
/* It must not happen that what we once saved in an FPR now /* It must not happen that what we once saved in an FPR now
needs a stack slot. */ needs a stack slot. */
gcc_assert (cfun_gpr_save_slot (gpr_regno) != -1); gcc_assert (cfun_gpr_save_slot (gpr_regno) != -1);
...@@ -10942,8 +10936,6 @@ s390_optimize_prologue (void) ...@@ -10942,8 +10936,6 @@ s390_optimize_prologue (void)
if (GET_CODE (base) != REG || off < 0) if (GET_CODE (base) != REG || off < 0)
continue; continue;
RTX_FRAME_RELATED_P (insn) = 0;
if (cfun_frame_layout.first_restore_gpr != -1 if (cfun_frame_layout.first_restore_gpr != -1
&& (cfun_frame_layout.first_restore_gpr < first && (cfun_frame_layout.first_restore_gpr < first
|| cfun_frame_layout.last_restore_gpr > last)) || cfun_frame_layout.last_restore_gpr > last))
...@@ -10961,8 +10953,19 @@ s390_optimize_prologue (void) ...@@ -10961,8 +10953,19 @@ s390_optimize_prologue (void)
- first) * UNITS_PER_LONG, - first) * UNITS_PER_LONG,
cfun_frame_layout.first_restore_gpr, cfun_frame_layout.first_restore_gpr,
cfun_frame_layout.last_restore_gpr); cfun_frame_layout.last_restore_gpr);
RTX_FRAME_RELATED_P (new_insn) = 0;
/* Remove REG_CFA_RESTOREs for registers that we no
longer need to save. */
REG_NOTES (new_insn) = REG_NOTES (insn);
for (rtx *ptr = &REG_NOTES (new_insn); *ptr; )
if (REG_NOTE_KIND (*ptr) == REG_CFA_RESTORE
&& ((int) REGNO (XEXP (*ptr, 0))
< cfun_frame_layout.first_restore_gpr))
*ptr = XEXP (*ptr, 1);
else
ptr = &XEXP (*ptr, 1);
new_insn = emit_insn_before (new_insn, insn); new_insn = emit_insn_before (new_insn, insn);
RTX_FRAME_RELATED_P (new_insn) = 1;
INSN_ADDRESSES_NEW (new_insn, -1); INSN_ADDRESSES_NEW (new_insn, -1);
} }
...@@ -10984,8 +10987,6 @@ s390_optimize_prologue (void) ...@@ -10984,8 +10987,6 @@ s390_optimize_prologue (void)
if (GET_CODE (base) != REG || off < 0) if (GET_CODE (base) != REG || off < 0)
continue; continue;
RTX_FRAME_RELATED_P (insn) = 0;
if (REGNO (base) != STACK_POINTER_REGNUM if (REGNO (base) != STACK_POINTER_REGNUM
&& REGNO (base) != HARD_FRAME_POINTER_REGNUM) && REGNO (base) != HARD_FRAME_POINTER_REGNUM)
continue; continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment