ROSE  0.9.9.109
Classes | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Backstroke::CFG< CFGNodeFilter > Class Template Reference

Description

template<class CFGNodeFilter>
class Backstroke::CFG< CFGNodeFilter >

A class holding a Control Flow Graph.

Definition at line 77 of file graphTemplate.h.

#include <graphTemplate.h>

Inheritance diagram for Backstroke::CFG< CFGNodeFilter >:
Inheritance graph
[legend]
Collaboration diagram for Backstroke::CFG< CFGNodeFilter >:
Collaboration graph
[legend]

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< CFGNodeTypeCFGNodePtr
 
typedef boost::shared_ptr< CFGEdgeTypeCFGEdgePtr
 
typedef GraphTraits::vertex_descriptor Vertex
 
typedef GraphTraits::edge_descriptor Edge
 
typedef std::map< Vertex, VertexVertexVertexMap
 

Public Member Functions

std::map< CFGNodeType, VertexgetNodeVert ()
 
 CFG ()
 The default constructor.
 
 CFG (SgFunctionDefinition *funcDef)
 The constructor building the CFG.
 
void build (SgFunctionDefinition *funcDef)
 Build the actual CFG for the given function.
 
SgFunctionDefinitiongetFunctionDefinition () const
 Get the function definition of this CFG.
 
const VertexgetEntry () const
 Get the entry node of the CFG.
 
const VertexgetExit () const
 Get the exit node of the CFG.
 
const VertexVertexMap & getDominatorTree ()
 Build the dominator tree of this CFG. More...
 
const VertexVertexMap & getPostdominatorTree ()
 Build the postdominator tree of this CFG.
 
CFG< CFGNodeFilter > makeReverseCopy () const
 Build a reverse CFG.
 
void toDot (const std::string &filename) const
 Output the graph to a DOT file.
 
std::vector< CFGNodePtr > getAllNodes () const
 Get all CFG nodes in this graph.
 
std::vector< CFGEdgePtr > getAllEdges () const
 Get all CFG edges in this graph.
 
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< EdgegetAllBackEdges ()
 Get all back edges in the CFG. A back edge is one whose target dominates its source.
 
std::vector< VertexgetAllLoopHeaders ()
 Get all loop headers in this CFG. A natural loop only has one header.
 

Public Attributes

Vertex entry_
 The entry node.
 
Vertex exit_
 The exit node.
 

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).
 
void setEntryAndExit ()
 Find the entry and exit of this CFG and set the corresponding members.
 
void writeGraphNode (std::ostream &out, const Vertex &node) const
 This function helps to write the DOT file for vertices.
 
void writeGraphEdge (std::ostream &out, const Edge &edge) const
 This function helps to write the DOT file for edges.
 

Protected Attributes

SgFunctionDefinitionfuncDef_
 The function definition of this CFG.
 
std::map< CFGNodeType, VertexnodesToVertices_
 A map from a CFG node to the corresponding vertex.
 
VertexVertexMap dominatorTree_
 The dominator tree of this CFG.
 
VertexVertexMap postdominatorTree_
 The postdominator tree of this CFG.
 

Member Function Documentation

template<class CFGNodeFilter >
const CFG< CFGNodeFilter >::VertexVertexMap & Backstroke::CFG< CFGNodeFilter >::getDominatorTree ( )

Build the dominator tree of this CFG.

Returns
A map from each node to its immediate dominator.

Definition at line 403 of file graphTemplate.h.

template<class CFGNodeFilter >
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.

template<class CFGNodeFilter>
bool Backstroke::CFG< CFGNodeFilter >::isReducible ( ) const
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.


The documentation for this class was generated from the following file: