ROSE
0.9.6a
|
#include <cong_staticCFG.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 boost::graph_traits < ControlFlowGraph > | GraphTraits |
typedef GraphTraits::vertex_descriptor | Vertex |
typedef GraphTraits::edge_descriptor | Edge |
typedef std::map< Vertex, Vertex > | VertexVertexMap |
typedef std::set< Vertex > | Vertices |
Public Member Functions | |
ControlFlowGraph () | |
The default constructor. More... | |
ControlFlowGraph (SgFunctionDefinition *funcDef, const CFGNodeFilter &cfgNodeFilter=DefaultFilter()) | |
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... | |
Vertex | getEntry () const |
Get the entry node of the CFG. More... | |
Vertex | getExit () const |
Get the exit node of the CFG. More... | |
void | setEntry (Vertex entry) |
Set the entry node of the CFG. More... | |
void | setExit (Vertex exit) |
Set the exit node of the CFG. More... | |
const VertexVertexMap & | getDominatorTree () const |
Build the dominator tree of this CFG. More... | |
const VertexVertexMap & | getPostdominatorTree () const |
Build the postdominator tree of this CFG. More... | |
ControlFlowGraph | 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 CFGNode &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::set< Edge > | getAllBackEdges () const |
Get all back edges in the CFG. A back edge is one whose target dominates its source. More... | |
Vertices | getAllLoopHeaders () const |
Get all loop headers in this CFG. A natural loop only has one header. More... | |
std::map< Vertex, Vertices > | getAllLoops () const |
Get all loops in this CFG. More... | |
Protected Member Functions | |
void | buildCFG (const CFGNode &node, std::map< CFGNode, Vertex > &nodesAdded, std::set< CFGNode > &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... | |
CFGNodePtr | newCFGNode (const CFGNode &node) |
CFGEdgePtr | newCFGEdge (const CFGEdge &edge) |
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... | |
CFGNodeFilter | filter_ |
The CFG node filter. More... | |
Vertex | entry_ |
The entry node. More... | |
Vertex | exit_ |
The exit node. More... | |
std::map< CFGNode, 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... | |
Definition at line 45 of file cong_staticCFG.h.
typedef boost::graph_traits<ControlFlowGraph> StaticCFG::ControlFlowGraph::GraphTraits |
Definition at line 49 of file cong_staticCFG.h.
typedef GraphTraits::vertex_descriptor StaticCFG::ControlFlowGraph::Vertex |
Definition at line 50 of file cong_staticCFG.h.
typedef GraphTraits::edge_descriptor StaticCFG::ControlFlowGraph::Edge |
Definition at line 51 of file cong_staticCFG.h.
typedef std::map<Vertex, Vertex> StaticCFG::ControlFlowGraph::VertexVertexMap |
Definition at line 53 of file cong_staticCFG.h.
typedef std::set<Vertex> StaticCFG::ControlFlowGraph::Vertices |
Definition at line 54 of file cong_staticCFG.h.
|
inline |
The default constructor.
Definition at line 82 of file cong_staticCFG.h.
|
inlineexplicit |
The constructor building the CFG.
Definition at line 91 of file cong_staticCFG.h.
References build().
void StaticCFG::ControlFlowGraph::build | ( | SgFunctionDefinition * | funcDef) |
Build the actual CFG for the given function.
Referenced by ControlFlowGraph().
|
inline |
Get the function definition of this CFG.
Definition at line 106 of file cong_staticCFG.h.
References funcDef_.
|
inline |
|
inline |
|
inline |
|
inline |
const VertexVertexMap& StaticCFG::ControlFlowGraph::getDominatorTree | ( | ) | const |
Build the dominator tree of this CFG.
const VertexVertexMap& StaticCFG::ControlFlowGraph::getPostdominatorTree | ( | ) | const |
Build the postdominator tree of this CFG.
ControlFlowGraph StaticCFG::ControlFlowGraph::makeReverseCopy | ( | ) | const |
Build a reverse CFG.
void StaticCFG::ControlFlowGraph::toDot | ( | const std::string & | filename) | const |
Output the graph to a DOT file.
std::vector<CFGNodePtr> StaticCFG::ControlFlowGraph::getAllNodes | ( | ) | const |
Get all CFG nodes in this graph.
std::vector<CFGEdgePtr> StaticCFG::ControlFlowGraph::getAllEdges | ( | ) | const |
Get all CFG edges in this graph.
Given a CFG node, returns the corresponding vertex in the graph.
Returns Vertex::null_vertex() if the given node is not in the graph
|
inline |
Return if this CFG is reducible (if all loops are natural loops, the CFG is reducible).
Definition at line 146 of file cong_staticCFG.h.
std::set<Edge> StaticCFG::ControlFlowGraph::getAllBackEdges | ( | ) | const |
Get all back edges in the CFG. A back edge is one whose target dominates its source.
Vertices StaticCFG::ControlFlowGraph::getAllLoopHeaders | ( | ) | const |
Get all loop headers in this CFG. A natural loop only has one header.
|
protected |
A internal funtion which builds the actual CFG (boost::graph).
|
protected |
Find the entry and exit of this CFG and set the corresponding members.
|
inlineprotected |
Definition at line 168 of file cong_staticCFG.h.
|
inlineprotected |
Definition at line 171 of file cong_staticCFG.h.
|
protected |
This function helps to write the DOT file for vertices.
|
protected |
This function helps to write the DOT file for edges.
|
protected |
The function definition of this CFG.
Definition at line 59 of file cong_staticCFG.h.
Referenced by getFunctionDefinition().
|
protected |
The CFG node filter.
Definition at line 62 of file cong_staticCFG.h.
|
protected |
The entry node.
Definition at line 65 of file cong_staticCFG.h.
Referenced by getEntry(), and setEntry().
|
protected |
The exit node.
Definition at line 68 of file cong_staticCFG.h.
A map from a CFG node to the corresponding vertex.
Definition at line 71 of file cong_staticCFG.h.
|
mutableprotected |
The dominator tree of this CFG.
Definition at line 74 of file cong_staticCFG.h.
|
mutableprotected |
The postdominator tree of this CFG.
Definition at line 77 of file cong_staticCFG.h.