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


Hello,

> >>What's the proposed usage idiom?
> >
> >
> >Here's an example from tree-cfg.c:
> >
> >  FOR_EACH_EDGE (ei, ENTRY_BLOCK_PTR->succs)
> >    {
> >      e = ei_edge (ei);
> 
> hmm, you've elided the declarations of EI and E.  Once you've added
> those, what does 'struct edge_iterator' buy you?
> 	edge_iterator ei;
> 	edge e;
> 	FOR_EACH_EDGE(ei, ENTRY_BLOCK_PTR->succs)
> 	  {
> 		e = ei_edge (ei);
> 		...
> 	  }
> vs
> 	int ix;
> 	edge e;
> 	FOR_EACH_EDGE (ix, ENTRY_BLOCK_PTR->succs, e)
> 	   {
> 	      ...
> 	   }
> 
> looks like needless source indirection to me. I suppose the edge_iterator
> avoids multiple evaluations of ENTRY_BLOCK_PTR->succs and the like.

it enables addition of the checking code (with variables specific for
the checking code).

Zdenek


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