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

basicblockNode Class Reference

Basic block. More...

#include <ast.h>

Inheritance diagram for basicblockNode::

blockNode stmtNode Node List of all members.

Public Methods

 basicblockNode (decl_list *decls, stmt_list *stmts, const Coord left_coord=Coord::Unknown, const Coord right_brace=Coord::Unknown)
 Create a new basic block. More...

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

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

Accessors
Methods to get and set fields in the class.

basicblock_list & preds ()
const basicblock_list & preds () const
basicblock_list & succs ()
const basicblock_list & succs () const
basicblockNode * parent () const
void parent (basicblockNode *par)
basicblock_list & children ()
const basicblock_list & children () const
algorithm_info * info () const
void info (algorithm_info *i)
int dfn () const
void dfn (int d)
FlowVal * at_entry () const
void at_entry (FlowVal *ae)
FlowVal * at_exit () const
void at_exit (FlowVal *ae)
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

basicblock_list _preds
 the control-flow predecessors. More...

basicblock_list _succs
 the control-flow successors. More...

basicblockNode * _parent
 the parent in the dominator tree. More...

basicblock_list _children
 the children in the dominator tree. More...

algorithm_info * _info
 algorithm info. More...

int _dfn
 depth-first numbering. More...

FlowVal * _at_entry
 dataflow analysis entry value. More...

FlowVal * _at_exit
 dataflow analysis exit value. More...


Detailed Description

Basic block.

This subclass of blockNode represents code in basic block form to support the construction of a control-flow graph and algorithms based on that graph. Initial parsing does not produce this form. To convert the AST into a control-flow graph, first dismantle the code (using the Dismantle class) then invoke the control-flow graph algorithm (using the cfg_changer). This form also supports several other analysis algorithms, such as dominators (using the Dominators class), dominance frontiers (using the DominanceFrontiers class) and pointer analysis (using the Pointers class).

Each basicblockNode has added fields for specifying control-flow predecessors and successors, as well as fields for representing a dominator tree.

The NodeType is Block (from the superclass)

See also:
Dismantle , cfg_changer , Dominators , DominanceFrontiers , Pointers


Constructor & Destructor Documentation

basicblockNode::basicblockNode (  decl_list *    decls,
stmt_list *    stmts,
const Coord    left_coord = Coord::Unknown,
const Coord    right_brace = Coord::Unknown
) 
 

Create a new basic block.

The basic block has the given declarations and statements (see the constructor for blockNode). By default, all the lists are empty, and the other references are null.

Parameters:
decls  the list of declarations
stmts  the list of statements
coord  the location of the left curly brace in the source file.
coord  the location of the right curly brace in the source file.

basicblockNode::~basicblockNode (    )  [virtual]
 

Destroy a basicblockNode.

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


Member Function Documentation

void basicblockNode::at_entry (  FlowVal *    ae )  [inline]
 

FlowVal* basicblockNode::at_entry (    )  const [inline]
 

void basicblockNode::at_exit (  FlowVal *    ae )  [inline]
 

Reimplemented from stmtNode.

FlowVal* basicblockNode::at_exit (    )  const [inline]
 

Reimplemented from stmtNode.

Node * basicblockNode::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 blockNode.

const basicblock_list& basicblockNode::children (    )  const [inline]
 

basicblock_list& basicblockNode::children (    )  [inline]
 

virtual Node* basicblockNode::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 blockNode.

void basicblockNode::dfn (  int    d )  [inline]
 

int basicblockNode::dfn (    )  const [inline]
 

void basicblockNode::info (  algorithm_info *    i )  [inline]
 

algorithm_info* basicblockNode::info (    )  const [inline]
 

void basicblockNode::parent (  basicblockNode *    par )  [inline]
 

basicblockNode* basicblockNode::parent (    )  const [inline]
 

const basicblock_list& basicblockNode::preds (    )  const [inline]
 

basicblock_list& basicblockNode::preds (    )  [inline]
 

const basicblock_list& basicblockNode::succs (    )  const [inline]
 

basicblock_list& basicblockNode::succs (    )  [inline]
 

void basicblockNode::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 blockNode.

void basicblockNode::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 blockNode.


Member Data Documentation

FlowVal* basicblockNode::_at_entry [private]
 

dataflow analysis entry value.

This field is used by the dataflow analysis framework to accumulate the flow-value coming into the basic block from it's predecessors. Sometimes, it's referred to as IN[B].

FlowVal* basicblockNode::_at_exit [private]
 

dataflow analysis exit value.

This field is used by the dataflow analysis framework to hold the flow value exiting the basic block. It is typically computed by passing the _at_entry through the transfer functions of the statements in the block. Sometimes, it's referred to as OUT[B].

Reimplemented from stmtNode.

basicblock_list basicblockNode::_children [private]
 

the children in the dominator tree.

This is the set of basic blocks that are immediately dominated by this one.

int basicblockNode::_dfn [private]
 

depth-first numbering.

Each basic block can be assignmed a number, usually in depth-first order. This is useful for building a bit-vector representation of sets of basic blocks.

algorithm_info* basicblockNode::_info [private]
 

algorithm info.

This field is used by various algorithms to temporarily attach some information to a basic block.

basicblockNode* basicblockNode::_parent [private]
 

the parent in the dominator tree.

This is the immediate dominator of this basic block.

basicblock_list basicblockNode::_preds [private]
 

the control-flow predecessors.

basicblock_list basicblockNode::_succs [private]
 

the control-flow successors.


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