This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] Mixed results with O(1) PHI arg lookup
- From: Andrew MacLeod <amacleod at redhat dot com>
- To: Kazu Hirata <kazu at cs dot umass dot edu>
- Cc: gcc mailing list <gcc at gcc dot gnu dot org>, stevenb at suse dot de
- Date: Fri, 05 Nov 2004 08:42:08 -0500
- Subject: Re: [RFC] Mixed results with O(1) PHI arg lookup
- References: <20041105.071419.71105057.kazu@cs.umass.edu>
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