SH::ShCtrlGraphNode Class Reference

A node in the control graph. More...

#include <ShCtrlGraph.hpp>

Inheritance diagram for SH::ShCtrlGraphNode:

Inheritance graph
[legend]
Collaboration diagram for SH::ShCtrlGraphNode:

Collaboration graph
[legend]
List of all members.

Public Types

typedef std::vector< ShCtrlGraphBranchSuccessorList
typedef std::list< ShCtrlGraphNode * > ShPredList
typedef std::set< ShVariableNodePtrDeclSet
typedef DeclSet::const_iterator DeclIt

Public Member Functions

 ShCtrlGraphNode ()
 ~ShCtrlGraphNode ()
std::ostream & print (std::ostream &out, int indent) const
 Output a graph node _and its successors_ at the given indentation level.
std::ostream & graphvizDump (std::ostream &out) const
 Output a graph node and its successors in graphviz format.
void append (const ShPointer< ShCtrlGraphNode > &node)
 Append an unconditional successor, if node is not null.
void append (const ShPointer< ShCtrlGraphNode > &node, ShVariable cond)
 Append an conditional successor, if node is not null.
ShPointer< ShCtrlGraphNodesplit (ShBasicBlock::ShStmtList::iterator stmt)
 Splits this control graph node into two nodes A, B, at the given statement.
void addDecl (ShVariableNodePtr node)
 Adds a temporary declaration to this cfg node.
bool hasDecl (ShVariableNodePtr node) const
 Returns whether this node contains a declaration for the given node.
void insert_decls (DeclIt f, DeclIt l)
 Inserts the given declarations into this.
DeclIt decl_begin () const
 Iterators into the decl set.
DeclIt decl_end () const
bool marked () const
 Whether this node has been "marked".
void mark () const
 Set the marked flag.
void clearMarked () const
 Clears the marked flag of this and all successors'/followers flags.
template<typename F>
void dfs (F &functor)
template<typename F>
void dfs (F &functor) const

Public Attributes

ShBasicBlockPtr block
SuccessorList successors
 Conditional successors.
ShPointer< ShCtrlGraphNodefollower
 Unconditional successor.
ShPredList predecessors

Detailed Description

A node in the control graph.

This contains of (optionally) some code, in the form of a basic block, 0 or more conditional successors (nodes which will be branched to if a particular variable is greater than 0) and one unconditional successor, which is another node that will be branched to if none of the conditional successors' conditions are true.

Only the exit node of a control graph will have an unconditional successor of 0.

Definition at line 56 of file ShCtrlGraph.hpp.


Member Function Documentation

std::ostream & SH::ShCtrlGraphNode::graphvizDump std::ostream &  out  )  const
 

Output a graph node and its successors in graphviz format.

See http://www.research.att.com/sw/tools/graphviz/ for more details.

Definition at line 66 of file ShCtrlGraph.cpp.

References decl_begin(), decl_end(), mark(), and marked().

bool SH::ShCtrlGraphNode::marked  )  const
 

Whether this node has been "marked".

Useful for mark and sweep type algorithms.

Definition at line 111 of file ShCtrlGraph.cpp.

Referenced by clearMarked(), graphvizDump(), and print().

ShCtrlGraphNodePtr SH::ShCtrlGraphNode::split ShBasicBlock::ShStmtList::iterator  stmt  ) 
 

Splits this control graph node into two nodes A, B, at the given statement.

A is this, and keeps all predecessor information, B is a new node that takes over all successor/follower B is NOT appended by default as a child of A

A contains a block with all the statements up to and including the given iterator. B contains a block with all statements after the given iterator.

This is useful for splicing in a control graph between A and B to replace some statement (or TODO a sequence of statements)

Returns B.

Definition at line 147 of file ShCtrlGraph.cpp.

References block, follower, ShCtrlGraphNode(), and successors.


The documentation for this class was generated from the following files:
Generated on Wed Nov 9 15:34:43 2005 for Sh by  doxygen 1.4.5