This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] Make tsi insert iterators handle chains of COMPOUND_EXPRs
- From: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- To: Richard Henderson <rth at redhat dot com>, gcc-patches at gcc dot gnu dot org,amacleod at redhat dot com, law at redhat dot com
- Date: Thu, 28 Aug 2003 23:40:29 +0200
- Subject: Re: [tree-ssa] Make tsi insert iterators handle chains of COMPOUND_EXPRs
- References: <20030828195323.GA19202@atrey.karlin.mff.cuni.cz> <20030828203336.GB5175@redhat.com>
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