state of 3.2.1-pre: how far from release?

Michael Matz matz@suse.de
Wed Nov 6 10:39:00 GMT 2002


Hi,

On Wed, 6 Nov 2002, David Edelsohn wrote:

> 	All instances of (reg/f:SI 929) are shared.

Doesn't matter in this case.

> Why doesn't the substition into the first operand affect all
> instances?

How could they?  the (reg 929) may be shared, but of course not the
 (plus:SI (reg 929) (const_int 4))  (for once, the constant is not the
same for them ;-) ) which are the operands here (not for recog though, but
they are supposed to be operands).  Ergo, if the first element of the
(plus) is changed to (plus (reg r1) (const 520)) (and the double plus
simplyfied), why should that change any of the other plus's?

There is some confusion here, because we right now call many things
substitution/elimination.  There is first the substitution of all pseudos
which got a hardreg with that hardreg (done in alter_reg(), and only here
matters the shared-ness of pseudo regs), which is simply done by
overwriting the REGNO integer in the (one an only) pseudo reg rtl.  But
this doesn't apply here anyway, reg 929 did not get a hardreg.

But we have other substitutions, and one of them is a part of
eliminate_regs(), in particular the substitution of pseudos which didn't
get hardregs with equivalent constants when they exist).  That hasn't much
to do with register elimination (like fp --> sp elim), but is done in the
same routine.  The way it is done is by simply replacing all operands
which are pseudos with their constants.  If some of the RTL isn't matched
by operands, we can't substitute it with the constant.

> Or, another way of stating it, why doesn't the substitution overwrite
> the RTL at the pointer instead of changing the pointer of the first
> operand, at least for match_parallel?

This can't be done.  We basically have this situation:
  op1 = (reg 929)
  op2 = (plus (reg 929) (const 4))
  op3 = (plus (reg 929) (const 8))

We also know, that (reg 929) == (plus (reg r11) 520).

Now how would you like to only change one of the three operands above, but
reflect that change automatically in the others too?  The only thing they
have in common are the (reg 929), ergo we would need to replace the
content of that rtx itself (like we overwrite the REGNO integer for the
pseudo-->hardreg conversion).  A REG rtx and a PLUS have both two
operands, so it _would_ possibly work, but then we have a shared (plus)
between the three operands, and can't change one without the others (for
any adjustments or whatever), so we would need to unshare them again,
which would again need accessing all three operands directly.  Besides
from the point that this is equivalent of directly replacing the first
element of the above (plus)'es (the reg) directly by (a copy of) the
constant.

No, that's never going to work, either the recog_data.operands[] array
(and the other things in recog_data) reflects _all_ real operands of an
instruction, or reload (and register elimination as we see here) needs to
be heavily changed (at least if this is supposed to work generally, maybe
there would be some hacks involving replace_rtx() to make this particular
case work).

As you said this works in HEAD, does anybody know if this issue really is
fixed there, or does it simply not happen there?


Ciao,
Michael.



More information about the Gcc mailing list