PATCH: use type-safe vectors for basic block edges

Nathan Sidwell nathan@codesourcery.com
Tue Sep 14 09:04:00 GMT 2004


Ben Elliston wrote:
> Richard Henderson <rth@redhat.com> writes:
> 
> 
>>On Tue, Sep 14, 2004 at 12:01:59PM +1000, Ben Elliston wrote:
>>
>>>How does this revised patch to basic-block.h look?
>>
>>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.

nathan

-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk




More information about the Gcc-patches mailing list