Commit 68342d36 by Richard Kenner

(reg_equiv_replace): New variable.

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

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