Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

subdeclNode Class Reference

Indexed declaration. More...

#include <ast.h>

Inheritance diagram for subdeclNode::

declNode defNode Node List of all members.

Public Methods

 subdeclNode (declNode *orig, int index)
 Create a sub-declaration. More...

virtual ~subdeclNode ()
 Destroy a subdeclNode. More...

string name_with_index ()
 Get the name with index. More...

virtual Node * clone () const
 Clone the input node. More...

virtual void output (output_context &ct, Node *par)
 Generate C code. More...

Accessors
Methods to get and set fields in the class.

virtual declNode * original ()
 SSA original declaration. More...

int index () const
AST Traversal
Methods to uniformly traverse the AST. See the documentation in the Node class.

virtual void visit (Visitor *the_visitor)
 Dispatch a Visitor. More...

virtual void walk (Walker &the_walker)
 Dispatch a Walker. More...

virtual Node * change (Changer &the_changer, bool redispatch=false)
 Dispatch a Changer. More...


Private Attributes

REF declNode * _original
int _index

Detailed Description

Indexed declaration.

Subclass of declNode used to create derived indexed declarations. It is currently only used in the SSA pass, which creates a series of indexed version of each variable. A subdeclNode consists of a base declaration and a subscript. For example, the indexed declaration for has the declaration for x as it base and has a subscript of 1. Sometimes, the subdeclNode's base is also refered to as its "original" declaration. The subdeclNode's subscript is also called its version or its index.

The NodeType is Decl.


Constructor & Destructor Documentation

subdeclNode::subdeclNode (  declNode *    orig,
int    index
) 
 

Create a sub-declaration.

This constructor creates a new sub-declaration of the given input declaration. The index indicates which version (or subscript) to associate with the sub-declaration.

Parameters:
orig  the original declaration from which this subdeclaration is derived
index  the index of the new sub-declaration

subdeclNode::~subdeclNode (    )  [virtual]
 

Destroy a subdeclNode.

Warning:
Do not use the destructors to delete AST nodes. Instead, rely on the node garbage collector.


Member Function Documentation

Node * subdeclNode::change (  Changer &    the_changer,
bool    redispatch = false
)  [virtual]
 

Dispatch a Changer.

This abstract method works much the walker, but allows the tree to be changed.

Parameters:
the_changer  the specific Changer object to use.
redispatch  pass true to revisit parts of the tree that have changed.

Reimplemented from declNode.

virtual Node* subdeclNode::clone (    )  const [inline, virtual]
 

Clone the input node.

This is not a "deep" clone, so be careful. For a deep clone, use the clone_changer class.

Returns:
a shallow copy of the node (no subtrees are copied).

Reimplemented from declNode.

int subdeclNode::index (    )  const [inline]
 

string subdeclNode::name_with_index (    ) 
 

Get the name with index.

This method returns the name of the declaration, with its index appended. For example, when this method is called on the subdeclaration for , the string "x@1" will be returned.

Returns:
the name with the index appended

virtual declNode* subdeclNode::original (    )  [inline, virtual]
 

SSA original declaration.

For use with subdeclNode when the code is in SSA form. This method returns the original declaration from which the sub-declaration was derived.

Returns:
the original declaration

Reimplemented from declNode.

void subdeclNode::output (  output_context &    ct,
Node *    parent
)  [virtual]
 

Generate C code.

Each subclass overrides this method to define how to produce the output C code. To use this method, pass an output_context and a null parent.

Parameters:
ct  the output context which describes the formatting.
par  the parent node (or null, if at the top of a subtree).

Reimplemented from declNode.

void subdeclNode::visit (  Visitor *    the_visitor )  [virtual]
 

Dispatch a Visitor.

This abstract method is the entry point for the visitor design pattern. Each node subclass defines a visit() method that calls the appropriate at_ method in the visitor. For more information see the Visitor documentation.

Parameters:
the_visitor  the specific Visitor object to use.

Reimplemented from declNode.

void subdeclNode::walk (  Walker &    the_walker )  [virtual]
 

Dispatch a Walker.

This abstract method works much like the visitor, but instead walks the entire underlying subtree calling the appropriate at_ method at each node. For more information see the Walker documentation.

Parameters:
the_walker  the specific Walker object to use.

Reimplemented from declNode.


Member Data Documentation

int subdeclNode::_index [private]
 

REF declNode* subdeclNode::_original [private]
 


The documentation for this class was generated from the following files:
Generated on Thu Jan 10 12:06:34 2002 for C-Breeze by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001