Commit 3ec2ea3e by Doug Evans

reload1.c: (init_reload): use HARD_FRAME_POINTER_REGNUM instead of FRAME_POINTER_REGNUM.

* reload1.c: (init_reload): use HARD_FRAME_POINTER_REGNUM instead of
FRAME_POINTER_REGNUM.
(reload): Only prohibit elimination of HARD_FRAME_POINTER_REGNUM, not
FRAME_POINTER_REGNUM if frame_pointer_needed.  Never prohibit
elimination of FRAME_POINTER_REGNUM into HARD_FRAME_POINTER_REGNUM.
Mark HARD_FRAME_POINTER_REGNUM as live at the start of a block if
it is still needed after elimination.
(eliminate_regs): For non-local goto's, don't delete stores into the
hard frame pointer.
(eliminate_regs_in_insn): adjust comment.
(mark_not_eliminable): if frame_pointer_rtx and hard_frame_pointer_rtx
are not the same, then frame_pointer_rtx is eliminable;
hard_frame_pointer_rtx never is if it is set..
(order_regs_for_reload): HARD_FRAME_POINTER_REGNUM is a bad spill reg.
(choose_reload_regs): HARD_FRAME_POINTER_REGNUM is a bad choice.

From-SVN: r5463
parent a36d4c62
...@@ -398,7 +398,7 @@ init_reload () ...@@ -398,7 +398,7 @@ init_reload ()
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
{ {
tem = gen_rtx (PLUS, Pmode, tem = gen_rtx (PLUS, Pmode,
gen_rtx (REG, Pmode, FRAME_POINTER_REGNUM), gen_rtx (REG, Pmode, HARD_FRAME_POINTER_REGNUM),
gen_rtx (REG, Pmode, i)); gen_rtx (REG, Pmode, i));
/* This way, we make sure that reg+reg is an offsettable address. */ /* This way, we make sure that reg+reg is an offsettable address. */
tem = plus_constant (tem, 4); tem = plus_constant (tem, 4);
...@@ -607,7 +607,8 @@ reload (first, global, dumpfile) ...@@ -607,7 +607,8 @@ reload (first, global, dumpfile)
{ {
ep->can_eliminate = ep->can_eliminate_previous ep->can_eliminate = ep->can_eliminate_previous
= (CAN_ELIMINATE (ep->from, ep->to) = (CAN_ELIMINATE (ep->from, ep->to)
&& (ep->from != FRAME_POINTER_REGNUM || ! frame_pointer_needed)); && (ep->from != HARD_FRAME_POINTER_REGNUM
|| ! frame_pointer_needed));
} }
#else #else
reg_eliminate[0].can_eliminate = reg_eliminate[0].can_eliminate_previous reg_eliminate[0].can_eliminate = reg_eliminate[0].can_eliminate_previous
...@@ -1496,7 +1497,7 @@ reload (first, global, dumpfile) ...@@ -1496,7 +1497,7 @@ reload (first, global, dumpfile)
since they can't have changed. */ since they can't have changed. */
for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS]; ep++) for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS]; ep++)
if ((ep->from == FRAME_POINTER_REGNUM && FRAME_POINTER_REQUIRED) if ((ep->from == HARD_FRAME_POINTER_REGNUM && FRAME_POINTER_REQUIRED)
#ifdef ELIMINABLE_REGS #ifdef ELIMINABLE_REGS
|| ! CAN_ELIMINATE (ep->from, ep->to) || ! CAN_ELIMINATE (ep->from, ep->to)
#endif #endif
...@@ -1545,7 +1546,8 @@ reload (first, global, dumpfile) ...@@ -1545,7 +1546,8 @@ reload (first, global, dumpfile)
frame_pointer_needed = 1; frame_pointer_needed = 1;
for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS]; ep++) for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS]; ep++)
{ {
if (ep->can_eliminate && ep->from == FRAME_POINTER_REGNUM) if (ep->can_eliminate && ep->from == FRAME_POINTER_REGNUM
&& ep->to != HARD_FRAME_POINTER_REGNUM)
frame_pointer_needed = 0; frame_pointer_needed = 0;
if (! ep->can_eliminate && ep->can_eliminate_previous) if (! ep->can_eliminate && ep->can_eliminate_previous)
...@@ -1930,8 +1932,9 @@ reload (first, global, dumpfile) ...@@ -1930,8 +1932,9 @@ reload (first, global, dumpfile)
if (! frame_pointer_needed) if (! frame_pointer_needed)
for (i = 0; i < n_basic_blocks; i++) for (i = 0; i < n_basic_blocks; i++)
basic_block_live_at_start[i][FRAME_POINTER_REGNUM / REGSET_ELT_BITS] basic_block_live_at_start[i][HARD_FRAME_POINTER_REGNUM / REGSET_ELT_BITS]
&= ~ ((REGSET_ELT_TYPE) 1 << (FRAME_POINTER_REGNUM % REGSET_ELT_BITS)); &= ~ ((REGSET_ELT_TYPE) 1 << (HARD_FRAME_POINTER_REGNUM
% REGSET_ELT_BITS));
/* Come here (with failure set nonzero) if we can't get enough spill regs /* Come here (with failure set nonzero) if we can't get enough spill regs
and we decide not to abort about it. */ and we decide not to abort about it. */
...@@ -2969,17 +2972,18 @@ eliminate_regs (x, mem_mode, insn) ...@@ -2969,17 +2972,18 @@ eliminate_regs (x, mem_mode, insn)
/* See if this is setting the replacement register for an /* See if this is setting the replacement register for an
elimination. elimination.
If DEST is the frame pointer, we do nothing because we assume that If DEST is the hard frame pointer, we do nothing because we
all assignments to the frame pointer are for non-local gotos and assume that all assignments to the frame pointer are for
are being done at a time when they are valid and do not disturb non-local gotos and are being done at a time when they are valid
anything else. Some machines want to eliminate a fake argument and do not disturb anything else. Some machines want to
pointer with either the frame or stack pointer. Assignments to eliminate a fake argument pointer (or even a fake frame pointer)
the frame pointer must not prevent this elimination. */ with either the real frame or the stack pointer. Assignments to
the hard frame pointer must not prevent this elimination. */
for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS]; for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS];
ep++) ep++)
if (ep->to_rtx == SET_DEST (x) if (ep->to_rtx == SET_DEST (x)
&& SET_DEST (x) != frame_pointer_rtx) && SET_DEST (x) != hard_frame_pointer_rtx)
{ {
/* If it is being incremented, adjust the offset. Otherwise, /* If it is being incremented, adjust the offset. Otherwise,
this elimination can't be done. */ this elimination can't be done. */
...@@ -3264,11 +3268,11 @@ eliminate_regs_in_insn (insn, replace) ...@@ -3264,11 +3268,11 @@ eliminate_regs_in_insn (insn, replace)
modifies DEST in any way other than by adding a constant integer to it. modifies DEST in any way other than by adding a constant integer to it.
If DEST is the frame pointer, we do nothing because we assume that If DEST is the frame pointer, we do nothing because we assume that
all assignments to the frame pointer are nonlocal gotos and are being done all assignments to the hard frame pointer are nonlocal gotos and are being
at a time when they are valid and do not disturb anything else. done at a time when they are valid and do not disturb anything else.
Some machines want to eliminate a fake argument pointer with either the Some machines want to eliminate a fake argument pointer with either the
frame or stack pointer. Assignments to the frame pointer must not prevent frame or stack pointer. Assignments to the hard frame pointer must not
this elimination. prevent this elimination.
Called via note_stores from reload before starting its passes to scan Called via note_stores from reload before starting its passes to scan
the insns of the function. */ the insns of the function. */
...@@ -3286,7 +3290,7 @@ mark_not_eliminable (dest, x) ...@@ -3286,7 +3290,7 @@ mark_not_eliminable (dest, x)
if (GET_CODE (dest) == SUBREG) if (GET_CODE (dest) == SUBREG)
dest = SUBREG_REG (dest); dest = SUBREG_REG (dest);
if (dest == frame_pointer_rtx) if (dest == hard_frame_pointer_rtx)
return; return;
for (i = 0; i < NUM_ELIMINABLE_REGS; i++) for (i = 0; i < NUM_ELIMINABLE_REGS; i++)
...@@ -3523,8 +3527,8 @@ order_regs_for_reload () ...@@ -3523,8 +3527,8 @@ order_regs_for_reload ()
#endif #endif
} }
} }
hard_reg_n_uses[FRAME_POINTER_REGNUM].uses += 2 * large + 2; hard_reg_n_uses[HARD_FRAME_POINTER_REGNUM].uses += 2 * large + 2;
SET_HARD_REG_BIT (bad_spill_regs, FRAME_POINTER_REGNUM); SET_HARD_REG_BIT (bad_spill_regs, HARD_FRAME_POINTER_REGNUM);
#ifdef ELIMINABLE_REGS #ifdef ELIMINABLE_REGS
/* If registers other than the frame pointer are eliminable, mark them as /* If registers other than the frame pointer are eliminable, mark them as
...@@ -5048,7 +5052,7 @@ choose_reload_regs (insn, avoid_return_reg) ...@@ -5048,7 +5052,7 @@ choose_reload_regs (insn, avoid_return_reg)
/* If we found an equivalent reg, say no code need be generated /* If we found an equivalent reg, say no code need be generated
to load it, and use it as our reload reg. */ to load it, and use it as our reload reg. */
if (equiv != 0 && regno != FRAME_POINTER_REGNUM) if (equiv != 0 && regno != HARD_FRAME_POINTER_REGNUM)
{ {
reload_reg_rtx[r] = equiv; reload_reg_rtx[r] = equiv;
reload_inherited[r] = 1; reload_inherited[r] = 1;
......
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