[tree-ssa] Make tsi insert iterators handle chains of COMPOUND_EXPRs
Zdenek Dvorak
rakdver@atrey.karlin.mff.cuni.cz
Thu Aug 28 21:40:00 GMT 2003
Hello,
> On Thu, Aug 28, 2003 at 09:53:23PM +0200, Zdenek Dvorak wrote:
> > if (mode == TSI_SAME_STMT)
> > ! i->tp = &(TREE_OPERAND (*last, 1));
> > ! else if (mode == TSI_NEW_STMT)
> > ! i->tp = last != &t ? last : i->tp;
> [...]
> > if (mode == TSI_NEW_STMT)
> > i->tp = &(TREE_OPERAND (*(i->tp), 1));
> > + else if (mode == TSI_CHAIN_END)
> > + i->tp = last != &t ? last : &(TREE_OPERAND (*(i->tp), 1));
>
> Correct me if I'm wrong. It appears as if in the first case
> TSI_NEW_STMT leaves the pointer at the end of the chain that
> we inserted, and the second case leaves the pointer at the
> beginning.
the behavior is this:
for tsi_link_after:
TSI_NEW_STMT -- at start of the chain
TSI_CHAIN_END -- at the end of the chain
for tsi_link_before
TSI_NEW_STMT -- at the end of the chain
TSI_CHAIN_END -- at the start of the chain
while this may seem strange, it is intentional; with this behavior,
tsi_link_xxx (tsi, a, TSI_CHAIN_END);
tsi_link_xxx (tsi, b, TSI_CHAIN_END);
will link chain b to the correct position wrto chain a, regardless of
what xxx is.
(the behavior of TSI_NEXT_STMT is then set to the only senseful choice
that makes it to behave as now when we insert only single statement).
Zdenek
More information about the Gcc-patches
mailing list