Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

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< ShCtrlGraphBranch > SuccessorList
typedef std::list< ShCtrlGraphNode * > ShPredList

Public Member Functions

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.
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 62 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 71 of file ShCtrlGraph.cpp.

References follower, mark(), marked(), SH::ShPointer< T >::object(), and successors.

bool SH::ShCtrlGraphNode::marked  )  const
 

Whether this node has been "marked".

Useful for mark and sweep type algorithms.

Definition at line 106 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 before the given iterator. B contains a block with all statements after and including 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 142 of file ShCtrlGraph.cpp.

References block, follower, predecessors, and successors.


The documentation for this class was generated from the following files:
Generated on Mon Jan 24 18:38:07 2005 for Sh by  doxygen 1.4.1