Minor SSA cleanups

Daniel Berlin dan@cgsoftware.com
Thu Jun 21 08:13:00 GMT 2001


law@redhat.com writes:

> 
>  > >  > Why *do* we have block indices or pointers at all there?
>  > >  > They seem unecessary, especially given that a register can only have
>  > >  > one def. So to figure out what block it came from, ....
>  > > It's significantly simpler to just record where it came from when you
>  > > generate the PHI node.
>  > 
>  > Um, but it's not difficult to figure out what block a given register
>  > was def'd in.
>  > In fact, GCC is the *only* compiler I know of that records this info
>  > specifically in the phi nodes.
>  > 
>  > If you want to know what block a reg was def'd, use df.[ch].  Once you
>  > run the analyzer, it's a simple macro to give you where the definition
>  > is.
> I'm not convinced df.[ch] is the way to go yet.  It's rather heavy-weight for
> what we need to do while in SSA form. 

You mean in terms of time taken, or what?

Because i'm made it completely incremental.  So we can just share the
same df structure between all the ssa passes, and incrementally update
it.

If you meant in terms of interface, I agree, it's probably
heavyweight, because it can do so much more.  But it's intended to be
shared across multiple passes.

>  We're using it right now because it
> gives us the uses for a particular pseudo -- but we could do that just as
> easily with a much more lightweight hunk of code.

Sure, but why not reuse what is there.
It provides a nice interface to doing all these things. Whenever we
add another lightweight hunk of code, we seem to end up, even though
we don't intend it, with duplicated code everywhere.

> 
> And yes, you can do some indexing into the various tables we've got lying
> around, but why bother.  If we record the edge, then no indexing into the
> tables is needed when we go to insert the copies when we eliminate the
> phi nodes.
Well, like I said, for anything more than simple following phi node
edges, it's worthless.
I'm not sure which optimization you are doing, but in SSA CCP, GVN,
and PRE, it just wasn't enough.

> 
> Jeff
> 

-- 
"I have a friend named Dennis.  Both of his parents were midgets,
but he isn't a midget.  He's a midget-dwarf.  He's two inches
tall.  He's the one who poses for trophies.
"-Steven Wright



More information about the Gcc-patches mailing list