USE patch vs the PA
Jeffrey A Law
law@cygnus.com
Fri Oct 24 22:37:00 GMT 1997
In message < 199710250200.WAA00802@jfc. >you write:
> That's how it was intended to work. Insns are not scanned in the same
> order they are executed. Consider insns which appear in rtl in this
> order:
>
> (1) R1 = constant
> (2) R2 = R1
> (3) R1 = variable
Note that if REG_N_SETS (R1) == 1, then find_base_value should return
reg_base_value [REGNO (R1)] if it is nonzero.
Doing that, improving PLUS and handling autoinc is enough for the
testcase that I've been working with.
--
If we wanted to get more clever, then we'd change how we do alias propagation.
The way it works right now, if regA is set to regB + regC and we
don't know if regB & regC are "constant" when we see the set for
regA, then we just set reg_base_value[regA] = regA.
Assume that we later find that regC is initially set to a symbol_ref
and just incremented in a loop. Thus reg_base_value[regC] = regC
and can be considered "constant" once we've scanned all the insns.
But, when we do propagation of the aliases we've lost any information
that says regA might be related to regB or regC, and thus we can't
determine that reg_base_values[regA] can be set to regC.
To get better propagation, we could do something like
while (something changed)
for each insn
note_stores....
propagate alias info
We'd keep two arrays for base values. The first contains the constant
entries computed so far. The second contains the new tenative entries.
In find_base_value, you return the constant entries computed so far
whenever possible.
record_set records the info into the tenative base values array.
When we've scanned all the insns, we add entries from the tenative
reg base array to the known reg base array and repeat the entire
process until no new real base entries are created.
It's really not all that difficult -- I've actually got it in
my sandbox, though I haven't tested it all that much.
If you think it's worth trying to make "real" I can clean it up
easily and let you comment on it.
Obviously it will run slower than yours, so maybe we limit the
number of passes based on -O{X} or something of that nature.
jeff
More information about the Gcc
mailing list