(reg_equiv_replace): New variable.

(update_equiv_regs): Set reg_equiv_replacement for all REG_EQUIV
notes encountered or generated.

From-SVN: r12618
This commit is contained in:
Richard Kenner 1996-08-11 22:42:27 -04:00
parent 6a305f32b2
commit 68342d36e0
1 changed files with 35 additions and 21 deletions

View File

@ -236,7 +236,10 @@ static int this_insn_number;
static rtx this_insn;
/* Used to communicate changes made by update_equiv_regs to
memref_referenced_p. */
memref_referenced_p. reg_equiv_replacement is set for any REG_EQUIV note
found or created, so that we can keep track of what memory accesses might
be created later, e.g. by reload. */
static rtx *reg_equiv_replacement;
static void alloc_qty PROTO((int, enum machine_mode, int, int));
@ -955,12 +958,17 @@ static void
update_equiv_regs ()
{
rtx *reg_equiv_init_insn = (rtx *) alloca (max_regno * sizeof (rtx *));
/* Set when an attempt should be made to replace a register with the
associated reg_equiv_replacement entry at the end of this function. */
char *reg_equiv_replace
= (char *) alloca (max_regno * sizeof *reg_equiv_replace);
rtx insn;
reg_equiv_replacement = (rtx *) alloca (max_regno * sizeof (rtx *));
bzero ((char *) reg_equiv_init_insn, max_regno * sizeof (rtx *));
bzero ((char *) reg_equiv_replacement, max_regno * sizeof (rtx *));
bzero ((char *) reg_equiv_replace, max_regno * sizeof *reg_equiv_replace);
init_alias_analysis ();
@ -1069,32 +1077,38 @@ update_equiv_regs ()
REG_NOTES (insn) = note = gen_rtx (EXPR_LIST, REG_EQUIV, SET_SRC (set),
REG_NOTES (insn));
/* Don't mess with things live during setjmp. */
if (note && reg_live_length[regno] >= 0)
if (note)
{
int regno = REGNO (dest);
/* Note that the statement below does not affect the priority
in local-alloc! */
reg_live_length[regno] *= 2;
reg_equiv_replacement[regno] = XEXP (note, 0);
/* If the register is referenced exactly twice, meaning it is set
once and used once, indicate that the reference may be replaced
by the equivalence we computed above. If the register is only
used in one basic block, this can't succeed or combine would
have done it.
/* Don't mess with things live during setjmp. */
if (reg_live_length[regno] >= 0)
{
/* Note that the statement below does not affect the priority
in local-alloc! */
reg_live_length[regno] *= 2;
It would be nice to use "loop_depth * 2" in the compare
below. Unfortunately, LOOP_DEPTH need not be constant within
a basic block so this would be too complicated.
This case normally occurs when a parameter is read from memory
and then used exactly once, not in a loop. */
/* If the register is referenced exactly twice, meaning it is
set once and used once, indicate that the reference may be
replaced by the equivalence we computed above. If the
register is only used in one basic block, this can't succeed
or combine would have done it.
if (reg_n_refs[regno] == 2
&& reg_basic_block[regno] < 0
&& rtx_equal_p (XEXP (note, 0), SET_SRC (set)))
reg_equiv_replacement[regno] = SET_SRC (set);
It would be nice to use "loop_depth * 2" in the compare
below. Unfortunately, LOOP_DEPTH need not be constant within
a basic block so this would be too complicated.
This case normally occurs when a parameter is read from
memory and then used exactly once, not in a loop. */
if (reg_n_refs[regno] == 2
&& reg_basic_block[regno] < 0
&& rtx_equal_p (XEXP (note, 0), SET_SRC (set)))
reg_equiv_replace[regno] = 1;
}
}
}
@ -1115,7 +1129,7 @@ update_equiv_regs ()
{
int regno = REGNO (XEXP (link, 0));
if (reg_equiv_replacement[regno]
if (reg_equiv_replace[regno]
&& validate_replace_rtx (regno_reg_rtx[regno],
reg_equiv_replacement[regno], insn))
{