This is the mail archive of the gcc@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: [RFC] Mixed results with O(1) PHI arg lookup


On Fri, 2004-11-05 at 07:14, Kazu Hirata wrote:
> Hi,
> 

> 
> o Every time an edge is added or removed, I call a callback function
>   to appropriately resize PHI arg arrays.  This adds some overhead.
>   In particular, we don't have PHI nodes in RTL.  Even in tree, not
>   every basic block has PHI node.

> I thought about not adding CFG hooks and having add_phi_arg resize PHI
> arrays the first time add_phi_arg is called after adding edges, but
> this is a little dirty because we have some time period when
> PHI_NUM_ARGS != EDGE_COUNT.

but in theory, whoever is creating the edge must know that a phi
argument needs to be created for the new edge, and *should* be adding
the phi argument immediately after creating the edge. Or edges. You
could certainly create multiple edges , then add the PHI arguments.

I think it would be wrong to add the edges then allow other
optimizations to proceed without fixing up the PHI arguments, so I don't
see a problem having add_phi_arg() resize the PHI node to the number of
edges.  In fact, this could be more efficient if you were adding 20
edges for some reason, you only have to resize once if you create the 20
edges, then add the phi args.

Andrew  


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