This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] bsi_for_stmt
Hello,
> > this patch implements the function that enables to obtain an iterator
> > for the statement in constant time. This functionality seems to be
> > needed in several new patches (ivopts, Andrew Pinski's loops to memset
> > optimization pass, Dale Johannesen's implemenation of value profiling
> > on tree level).
> >
> Could you provide some examples? In principle, I don't see why an
> object should know about its container. When I've needed to manipulate
> statements, I just pass around SIs.
suppose you want to replace a statement defining a SSA name by some
other computation. From ssa name you get the defining statement, but to
replace it, you need a bsi. Passing around BSI's is cumbersome, slow,
and sometimes even wrong (in case cfg is manipulated, BSI's may become
invalid, if the statement they point to moves to a different basic
block).
Zdenek