This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: use type-safe vectors for basic block edges


On Sep 14, 2004 03:17 PM, Andrew MacLeod <amacleod@redhat.com> wrote:

> On Tue, 2004-09-14 at 02:50, Steven Bosscher wrote:
> > On Tuesday 14 September 2004 04:01, Ben Elliston wrote:
> > > How does this revised patch to basic-block.h look?
> > >
> > > The only unfortunate consequence of this patch is that there are
> > > no
> > > longer any safeguards to prevent the user from accidentally using
> > > the
> > > same iterator variable in a nest of FOR_EACH_EDGE loops.  By
> > > previously having an automatic variable declared inside a
> > > dedicated
> > > scoping block meant that this class of errors are eradicated.
> > 
> 
> I would assume this would show up pretty quickly though. 

Some of them, yes.   But most of them were surprisingly
difficult to find, unfortunately.

Think about missed jump threads for example.  Just a missed 
optimization, things like that.  That is why this checking
is so important.


> Set a new field in the iterator to the current edge.  Return it when
> asked for ei_edge().
> 
> ei_next() then checks the current index to see if its contents are the
> same as its current_edge field before bumping the index. If the field
> is
> different, it has been deleted so leave the field index the same, set
> the iterator current_edge field, and continue.

Yeah, that seems to be the right thing to do.  Should give us the
same kind of checking that we do now, but prettier :-)

Gr.
Steven




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]