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: [AST-optimizer-branch] Double chaining statements (proposal)


On Tue, Apr 23, 2002 at 10:28:10AM -0400, Diego Novillo wrote:
> At times I have wished I had a TREE_PREV() link, but I am not
> absolutely convinced that it is a requirement.  We have several
> options:
> 
> - Overloading an existing field.  This saves memory but abuses
>   the name space.  We already have much name abusing in the tree
>   structure.
> 
Yes but we can keep this information only locally and once we don't need
it anymore just reset it to NULL as it was before.

> - Creating a 'prev' field in tree_node.  IMO the cleanest
>   approach, but increases memory usage.
> 
Yep and this increases the size of the code for all nodes : 
statements as well as expressions that doesn't even use the 'chain' field.

> - Do nothing.  Every pass that needs to keep TREE_PREV pointers
>   should save 'prev' while traversing, and/or use the CFG to find
>   predecessors.  The second option is what we use once we have
>   the CFG.
> 
Yes but a 'prev' pointer is really difficult and expensive to maintain  
if the transformation has to insert new stmts in the stmt chain. 
(execution speed, writing code, maintaining code, ...)


> We need to find a balance between implementation complexity and
> compilation time.  No doubt that having TREE_PREV will help some
> traversals, particularly those that are done before the CFG is
> built.
> 
> However, the presence of TREE_PREV means that we have to go
> through every line of code that manipulates trees and make sure
> that every time we chain two tree statements, the TREE_PREV field
> of the second statement is updated properly.
> 
Not if we keep this modification locally.

Seb


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