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: remove bb_ann_d's num_preds field


On Tue, Oct 05, 2004 at 04:52:22PM -0600, Jeffrey A Law wrote:
> On Fri, 2004-10-01 at 00:04, Ben Elliston wrote:
> > Jeffrey A Law <law@redhat.com> writes:
> > 
> > > ie, how often is it the case that we're doing something like
> > > 
> > > FOR_EACH_EDGE (e, ei, bb->succs)
> > >   FOR_EACH_PHI in e->dest
> > >     find the argument associated with e
> > > 
> > > vs finding a PHI argument for an arbitrary edge.
> > > 
> > > Or something similar.  For the first class of uses we ought to be
> > > able to get the index via the FOR_EACH_EDGE code by keeping an index
> > > in the iterator.  In the second case we'd need an index in the edge
> > > itself or something similar.
> > 
> > If I'm understanding you correctly, Jeff, then that is already
> > available from edge_iterator's index member:
> > 
> >   typedef struct {
> >     unsigned index;
> >     VEC(edge) *container;
> >   } edge_iterator;
> Nuts.  As Zdenek mentioned, we need the index in the pred list
> for the block, not the index in the succ list of the parent.
> 
> ie, typically in this case we're doing something like
> 
> FOR_EACH_SUCCESSOR_OF_BB
>   FOR_EACH_PHI_IN_THE_SUCCESSOR
>     find the argument associated with the edge from BB to SUCCESSOR

Do we keep references to edges from other than their pred and succ
lists?  If not, maybe the earlier suggestion of putting the edges
(rather than pointers to them) in the pred list... then you can walk
the list of successors and use pointer subtraction to recover the
index.

This is an obvious time/space tradeoff - we'd recover
  (A) space for O(edges) pointers
  (B) space for O(edges) indices
at the cost of
  (A) O(predecessors) pointer updating when we have to resize the edge array

-- 
Daniel Jacobowitz


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