ROSE
0.9.6a
|
A class holding a Control Flow Graph. More...
#include <graphTemplate.h>
Classes | |
struct | EdgeCopier |
This class is used to copy edges when calling copy_graph(). More... | |
struct | VertexCopier |
This class is used to copy vertices when calling copy_graph(). More... | |
Public Types | |
typedef VirtualCFG::FilteredCFGNode < CFGNodeFilter > | CFGNodeType |
typedef VirtualCFG::FilteredCFGEdge < CFGNodeFilter > | CFGEdgeType |
typedef boost::shared_ptr < CFGNodeType > | CFGNodePtr |
typedef boost::shared_ptr < CFGEdgeType > | CFGEdgePtr |
typedef GraphTraits::vertex_descriptor | Vertex |
typedef GraphTraits::edge_descriptor | Edge |
typedef std::map< Vertex, Vertex > | VertexVertexMap |
Public Member Functions | |
std::map< CFGNodeType, Vertex > | getNodeVert () |
CFG () | |
The default constructor. More... | |
CFG (SgFunctionDefinition *funcDef) | |
The constructor building the CFG. More... | |
void | build (SgFunctionDefinition *funcDef) |
Build the actual CFG for the given function. More... | |
SgFunctionDefinition * | getFunctionDefinition () const |
Get the function definition of this CFG. More... | |
const Vertex & | getEntry () const |
Get the entry node of the CFG. More... | |
const Vertex & | getExit () const |
Get the exit node of the CFG. More... | |
const VertexVertexMap & | getDominatorTree () |
Build the dominator tree of this CFG. More... | |
const VertexVertexMap & | getPostdominatorTree () |
Build the postdominator tree of this CFG. More... | |
CFG< CFGNodeFilter > | makeReverseCopy () const |
Build a reverse CFG. More... | |
void | toDot (const std::string &filename) const |
Output the graph to a DOT file. More... | |
std::vector< CFGNodePtr > | getAllNodes () const |
Get all CFG nodes in this graph. More... | |
std::vector< CFGEdgePtr > | getAllEdges () const |
Get all CFG edges in this graph. More... | |
Vertex | getVertexForNode (const CFGNodeType &node) const |
Given a CFG node, returns the corresponding vertex in the graph. More... | |
bool | isReducible () const |
Return if this CFG is reducible (if all loops are natural loops, the CFG is reducible). More... | |
std::vector< Edge > | getAllBackEdges () |
Get all back edges in the CFG. A back edge is one whose target dominates its source. More... | |
std::vector< Vertex > | getAllLoopHeaders () |
Get all loop headers in this CFG. A natural loop only has one header. More... | |
Public Attributes | |
Vertex | entry_ |
The entry node. More... | |
Vertex | exit_ |
The exit node. More... | |
Protected Member Functions | |
void | buildCFG (const CFGNodeType &node, std::map< CFGNodeType, Vertex > &nodesAdded, std::set< CFGNodeType > &nodesProcessed) |
A internal funtion which builds the actual CFG (boost::graph). More... | |
void | setEntryAndExit () |
Find the entry and exit of this CFG and set the corresponding members. More... | |
void | writeGraphNode (std::ostream &out, const Vertex &node) const |
This function helps to write the DOT file for vertices. More... | |
void | writeGraphEdge (std::ostream &out, const Edge &edge) const |
This function helps to write the DOT file for edges. More... | |
Protected Attributes | |
SgFunctionDefinition * | funcDef_ |
The function definition of this CFG. More... | |
std::map< CFGNodeType, Vertex > | nodesToVertices_ |
A map from a CFG node to the corresponding vertex. More... | |
VertexVertexMap | dominatorTree_ |
The dominator tree of this CFG. More... | |
VertexVertexMap | postdominatorTree_ |
The postdominator tree of this CFG. More... | |
Private Types | |
typedef boost::graph_traits < CFG< CFGNodeFilter > > | GraphTraits |
A class holding a Control Flow Graph.
Definition at line 77 of file graphTemplate.h.
|
private |
Definition at line 119 of file graphTemplate.h.
typedef VirtualCFG::FilteredCFGNode<CFGNodeFilter> Backstroke::CFG< CFGNodeFilter >::CFGNodeType |
Definition at line 122 of file graphTemplate.h.
typedef VirtualCFG::FilteredCFGEdge<CFGNodeFilter> Backstroke::CFG< CFGNodeFilter >::CFGEdgeType |
Definition at line 123 of file graphTemplate.h.
typedef boost::shared_ptr<CFGNodeType> Backstroke::CFG< CFGNodeFilter >::CFGNodePtr |
Definition at line 125 of file graphTemplate.h.
typedef boost::shared_ptr<CFGEdgeType> Backstroke::CFG< CFGNodeFilter >::CFGEdgePtr |
Definition at line 126 of file graphTemplate.h.
typedef GraphTraits::vertex_descriptor Backstroke::CFG< CFGNodeFilter >::Vertex |
Definition at line 128 of file graphTemplate.h.
typedef GraphTraits::edge_descriptor Backstroke::CFG< CFGNodeFilter >::Edge |
Definition at line 129 of file graphTemplate.h.
typedef std::map<Vertex, Vertex> Backstroke::CFG< CFGNodeFilter >::VertexVertexMap |
Definition at line 131 of file graphTemplate.h.
|
inline |
The default constructor.
Definition at line 160 of file graphTemplate.h.
|
inlineexplicit |
The constructor building the CFG.
Definition at line 168 of file graphTemplate.h.
References Backstroke::CFG< CFGNodeFilter >::build().
|
inline |
Definition at line 155 of file graphTemplate.h.
References Backstroke::CFG< CFGNodeFilter >::nodesToVertices_.
void Backstroke::CFG< CFGNodeFilter >::build | ( | SgFunctionDefinition * | funcDef) |
Build the actual CFG for the given function.
Definition at line 287 of file graphTemplate.h.
References SgNode::cfgForBeginning(), and isSgFunctionDefinition().
Referenced by Backstroke::CFG< CFGNodeFilter >::CFG().
|
inline |
Get the function definition of this CFG.
Definition at line 180 of file graphTemplate.h.
References Backstroke::CFG< CFGNodeFilter >::funcDef_.
|
inline |
Get the entry node of the CFG.
Definition at line 184 of file graphTemplate.h.
References Backstroke::CFG< CFGNodeFilter >::entry_.
|
inline |
Get the exit node of the CFG.
Definition at line 188 of file graphTemplate.h.
References Backstroke::CFG< CFGNodeFilter >::exit_.
const CFG< CFGNodeFilter >::VertexVertexMap & Backstroke::CFG< CFGNodeFilter >::getDominatorTree | ( | ) |
Build the dominator tree of this CFG.
Definition at line 403 of file graphTemplate.h.
const CFG< CFGNodeFilter >::VertexVertexMap & Backstroke::CFG< CFGNodeFilter >::getPostdominatorTree | ( | ) |
Build the postdominator tree of this CFG.
Definition at line 416 of file graphTemplate.h.
CFG< CFGNodeFilter > Backstroke::CFG< CFGNodeFilter >::makeReverseCopy | ( | ) | const |
Build a reverse CFG.
Definition at line 429 of file graphTemplate.h.
References Backstroke::CFG< CFGNodeFilter >::entry_, and Backstroke::CFG< CFGNodeFilter >::exit_.
void Backstroke::CFG< CFGNodeFilter >::toDot | ( | const std::string & | filename) | const |
Output the graph to a DOT file.
Definition at line 278 of file graphTemplate.h.
std::vector< typename CFG< CFGNodeFilter >::CFGNodePtr > Backstroke::CFG< CFGNodeFilter >::getAllNodes | ( | ) | const |
Get all CFG nodes in this graph.
Definition at line 446 of file graphTemplate.h.
std::vector< typename CFG< CFGNodeFilter >::CFGEdgePtr > Backstroke::CFG< CFGNodeFilter >::getAllEdges | ( | ) | const |
Get all CFG edges in this graph.
Definition at line 468 of file graphTemplate.h.
CFG< CFGNodeFilter >::Vertex Backstroke::CFG< CFGNodeFilter >::getVertexForNode | ( | const CFGNodeType & | node) | const |
Given a CFG node, returns the corresponding vertex in the graph.
Returns Vertex::null_vertex() if the given node is not in the graph
Definition at line 477 of file graphTemplate.h.
|
inline |
Return if this CFG is reducible (if all loops are natural loops, the CFG is reducible).
Definition at line 216 of file graphTemplate.h.
std::vector< typename CFG< CFGNodeFilter >::Edge > Backstroke::CFG< CFGNodeFilter >::getAllBackEdges | ( | ) |
Get all back edges in the CFG. A back edge is one whose target dominates its source.
Definition at line 490 of file graphTemplate.h.
std::vector< typename CFG< CFGNodeFilter >::Vertex > Backstroke::CFG< CFGNodeFilter >::getAllLoopHeaders | ( | ) |
Get all loop headers in this CFG. A natural loop only has one header.
Definition at line 519 of file graphTemplate.h.
|
protected |
A internal funtion which builds the actual CFG (boost::graph).
Definition at line 340 of file graphTemplate.h.
References VirtualCFG::FilteredCFGNode< FilterFunction >::getNode(), VirtualCFG::FilteredCFGNode< FilterFunction >::outEdges(), StaticCFG::outEdges(), and VirtualCFG::FilteredCFGEdge< FilterFunction >::target().
|
protected |
Find the entry and exit of this CFG and set the corresponding members.
Definition at line 311 of file graphTemplate.h.
References isSgFunctionDefinition().
|
inlineprotected |
This function helps to write the DOT file for vertices.
Definition at line 235 of file graphTemplate.h.
References Backstroke::writeCFGNode().
|
inlineprotected |
This function helps to write the DOT file for edges.
Definition at line 242 of file graphTemplate.h.
References Backstroke::writeCFGEdge().
Vertex Backstroke::CFG< CFGNodeFilter >::entry_ |
The entry node.
Definition at line 133 of file graphTemplate.h.
Referenced by Backstroke::CFG< CFGNodeFilter >::getEntry(), and Backstroke::CFG< CFGNodeFilter >::makeReverseCopy().
Vertex Backstroke::CFG< CFGNodeFilter >::exit_ |
The exit node.
Definition at line 136 of file graphTemplate.h.
Referenced by Backstroke::CFG< CFGNodeFilter >::getExit(), and Backstroke::CFG< CFGNodeFilter >::makeReverseCopy().
|
protected |
The function definition of this CFG.
Definition at line 142 of file graphTemplate.h.
Referenced by Backstroke::CFG< CFGNodeFilter >::getFunctionDefinition().
|
protected |
A map from a CFG node to the corresponding vertex.
Definition at line 146 of file graphTemplate.h.
Referenced by Backstroke::CFG< CFGNodeFilter >::getNodeVert().
|
protected |
The dominator tree of this CFG.
Definition at line 149 of file graphTemplate.h.
|
protected |
The postdominator tree of this CFG.
Definition at line 152 of file graphTemplate.h.