#include <ast.h>
Inheritance diagram for procNode::
Parser methods | |
void | define (blockNode *body) |
procNode * | define_and (blockNode *body) |
procNode * | current () |
Public Methods | |
procNode (declNode *decl, blockNode *body, const Coord coord=Coord::Unknown) | |
Create a new procedure. More... | |
procNode (bool old_style, declNode *decl) | |
Create a procedure during parsing. More... | |
virtual | ~procNode () |
Destroy a procNode. More... | |
typeNode * | base_type (bool TdefIndir) const |
Return the base data type of a node. More... | |
virtual void | dataflow (FlowVal *v, FlowProblem &fp) |
Run the dataflow analyzer. 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. | |
declNode * | decl () const |
Return the declaration for this procNode. More... | |
declNode * | get_decl () |
Return the declaration for this procNode, and set it to be empty. More... | |
void | decl (declNode *decl) |
Set the declaration for this procNode to the given value. More... | |
blockNode * | body () const |
Return this procNode's body. More... | |
blockNode * | get_body () |
Return the body for this procNode, and set it to be empty. More... | |
void | body (blockNode *body) |
Set this procNode's body to the given value. More... | |
FlowVal * | at_entry () const |
Return this Node's at_entry dataflow analysis value. More... | |
void | at_entry (FlowVal *ae) |
Set this procNode's entry flow value. More... | |
FlowVal * | at_exit () const |
Return this Node's at_exit dataflow analysis value. More... | |
void | at_exit (FlowVal *ae) |
Set this procNode's exit flow value. More... | |
Control-flow Graph | |
These methods return the entry and exit basic blocks when a procedure is in control-flow graph form. Currently, the convention is that the first basic block is the entry and the last basic block is the exit; however, the user should not depend on this fact.
The control-flow graph is built using the cfg_changer.
| |
basicblockNode * | entry () const |
Entry basic block. More... | |
basicblockNode * | exit () const |
Exit basic block. More... | |
AST Traversal | |
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 | |
TREE declNode * | _decl |
Procedure declaration. More... | |
TREE blockNode * | _body |
Procedure body. More... | |
Dataflow analysis | |
FlowVal * | _at_entry |
FlowVal * | _at_exit |
Static Private Attributes | |
procNode * | _current = (procNode *)0 |
Current procedure during parsing. More... |
This class represents a procedure (or function) definition. The definition consists of a declarations (which gives the name and interface of the procedure) and the procedure body.
The NodeType is Proc.
|
Create a new procedure.
|
|
Create a procedure during parsing.
|
|
Destroy a procNode.
|
|
Set this procNode's entry flow value.
|
|
Return this Node's at_entry dataflow analysis value.
|
|
Set this procNode's exit flow value.
|
|
Return this Node's at_exit dataflow analysis value.
|
|
Return the base data type of a node. This method differs from the Node::type() method in two respects. First, it follows some of the simple type inferences. For example, calling it on an idNode will return the type of its declaration. Second, the boolean argument indicates whether or not to follow typedef links.
Reimplemented from Node. |
|
Set this procNode's body to the given value. To set this procNode's body to be empty, use a value of NULL. |
|
Return this procNode's body.
|
|
Dispatch a Changer. This abstract method works much the walker, but allows the tree to be changed.
Reimplemented from Node. |
|
Clone the input node. This is not a "deep" clone, so be careful. For a deep clone, use the clone_changer class.
Reimplemented from Node. |
|
|
|
Run the dataflow analyzer. Each subclass overrides this method to define it's semantics for dataflow analysis. It alters the input flow value to reflect the effect of the node within the given flow problem, calling dataflow() on it's subtrees as necessary. See the dataflow analysis documentation for more information.
Reimplemented from Node. |
|
Set the declaration for this procNode to the given value. To set this procNode's declaration to be empty, use a value of NULL. |
|
Return the declaration for this procNode. The declaration of the procedure consists of the name, plus the type, which specifies the function interface. The declaration's type is guaranteed to be a funcNode. |
|
|
|
|
|
Entry basic block.
|
|
Exit basic block.
|
|
Return the body for this procNode, and set it to be empty.
|
|
Return the declaration for this procNode, and set it to be empty.
The declaration of the procedure consists of the name, plus the type, which specifies the function interface. The declaration's type is guaranteed to be a funcNode. |
|
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.
Reimplemented from Node. |
|
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.
Reimplemented from Node. |
|
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.
Reimplemented from Node. |
|
|
|
|
|
Procedure body. The procedure body is represented as a statement block |
|
Current procedure during parsing.
|
|
Procedure declaration. The declaration of the procedure consists of the name, plus the type, which specifies the function interface. The type is always a funcNode. If _decl is NULL, then the procedure's declaration is empty. |