On Sat, 2005-09-17 at 14:59, Daniel Berlin wrote:
> It seems the only reason we have PHI_ARG_IMM_USE_NODE (and a struct
> ssa_use_operand_d) in a phi node argument (struct phi_arg_d) is *just*
> so we can iterate over the uses and hand back use_operand_p.
>
> I'm talking, in particular, about:
>
> struct phi_arg_d GTY(())
> {
> /* imm_use MUST be the first element in struct because we do some
> pointer arithmetic with it. See phi_arg_index_from_use. */
> struct ssa_use_operand_d imm_use;
>
> }
>
> It's not actually usfeul as an immediate use, since it doesn't actually
> point to an immediate use, and because you can get the argument itself
> from PHI_ARG_DEF.
>
how do you figure that?
a_1 = b_9
= a_1
<...>
a_9 = PHI <a_1(0), a_4(1), a_1 (2), a_6(3)>
If I want to replace all the uses of a_1 with b_9, I have to visit all 3
uses of a_1, via FOR_EACH_IMM_USE_SAFE... including the ones in the PHI
node.
So the arguments of the PHI node are indeed part the use list for a_1.
The imm_use structure *is* the use (in both PHI args and in stmts), and
it is linked in with the other uses of a_1.
The imm_use element is put first in the phi_arg_d structure for a
different reason, so that we can find the index of a USE that falls in a
PHI node if anyone wants it, via phi_arg_index_from_use.
Andrew