Chain PHI nodes via separate a chain field

S. Bosscher S.Bosscher@student.tudelft.nl
Wed Jun 16 16:42:00 GMT 2004


Andrew MacLeod wrote:
> On Wed, 2004-06-16 at 10:32, Jason Merrill wrote:
> > It seems like this will *increase* memory consumption until we
> > eventually do away with TREE_CHAIN.

Yes it will in the version I posted, though it's not that dramatic
when you consider this: It is only one pointer per PHI node, which
is absolutely nothing compared to what PHI arguments take, or those
half dozen pointers in a decl node that hardly any decl actually
needs.

Not that it's a good thing to increase memory usage, but you have to
put it in perspective.

I don't know "eventually" it will be before TREE_CHAIN goes away.
As far as I'm concerned: Soon.  I plan to introduce DECL_CHAIN next
and with that the majority of TREE_CHAIN users is already gone.

Jason, I hope you don't want a "flag day" patch for TREE_CHAIN too,
like for TREE_COMPLEXITY?  If that's what you prefer then I'm not
even going to look at this again ;-) Such a patch would be uber-huge!
We really have to attack TREE_CHAIN one user at a time.


> I do like the change to using PHI_CHAIN instead of TREE_CHAIN in the
> compiler. 
> 
> Any reason we can't simply have 
> 
> #define PHI_CHAIN(PHI)	TREE_CHAIN (PHI_NODE_CHECK (NODE))

Yes we can.  I even said that in my original mail.  I also explained
why I decided to create the separate field already.  In fact in my
first try on this I did reuse chain from tree_common, but it didn't
work and I only found out that we tried to nreverse the PHI chain
when I put in the new chain field in tree_phi_node.

The reason is simple: you can have a PHI_NODE_CHECK in PHI_CHAIN, but
not a NOT_PHI_NODE_CHECK in TREE_CHAIN (well, you can, but that was
where I needed the ugly hacks I mentioned ;-).

So it seemed like a safer approach to just make PHI_CHAIN use a new
field, so that bugs show up right away.  This is especially nice for
those working on branches or at home; it's easy to overlook this kind
of thing.

But using chain from tree_common is Just Fine with me too, of course.

Gr.
Steven



More information about the Gcc-patches mailing list