#include <ShCtrlGraph.hpp>
Inheritance diagram for SH::ShCtrlGraphNode:
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< ShCtrlGraphNode > | split (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< ShCtrlGraphNode > | follower |
Unconditional successor. | |
ShPredList | predecessors |
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.
|
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. |
|
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(). |
|
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. |