ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ssa_private::CFG< CFGNodeT, CFGEdgeT > Class Template Reference

A class holding a Control Flow Graph. More...

#include <boostGraphCFG.h>

Inheritance diagram for ssa_private::CFG< CFGNodeT, CFGEdgeT >:
Collaboration diagram for ssa_private::CFG< CFGNodeT, CFGEdgeT >:

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
< CFG< CFGNodeT, CFGEdgeT > > 
GraphTraits
 
typedef CFGNodeT CFGNodeType
 
typedef CFGEdgeT 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, VertexVertexVertexMap
 

Public Member Functions

 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...
 
SgFunctionDefinitiongetFunctionDefinition () const
 Get the function definition of this CFG. More...
 
const VertexgetEntry () const
 Get the entry node of the CFG. More...
 
const VertexgetExit () const
 Get the exit node of the CFG. More...
 
const VertexVertexMapgetDominatorTree ()
 Build the dominator tree of this CFG. More...
 
const VertexVertexMapgetPostdominatorTree ()
 Build the postdominator tree of this CFG. More...
 
CFG< CFGNodeT, CFGEdgeT > makeReverseCopy () const
 Build a reverse CFG. More...
 
std::vector< CFGNodePtrgetAllNodes () const
 Get all CFG nodes in this graph. More...
 
std::vector< CFGEdgePtrgetAllEdges () 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...
 
std::vector< EdgegetAllBackEdges ()
 Get all back edges in the CFG. A back edge is one whose target dominates its source. More...
 
std::vector< VertexgetAllLoopHeaders ()
 Get all loop headers in this CFG. A natural loop only has one header. 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...
 

Protected Attributes

SgFunctionDefinitionfuncDef_
 The function definition of this CFG. More...
 
Vertex entry_
 The entry node. More...
 
Vertex exit_
 The exit node. More...
 
std::map< CFGNodeType, VertexnodesToVertices_
 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...
 

Detailed Description

template<class CFGNodeT, class CFGEdgeT>
class ssa_private::CFG< CFGNodeT, CFGEdgeT >

A class holding a Control Flow Graph.

Definition at line 20 of file boostGraphCFG.h.

Member Typedef Documentation

template<class CFGNodeT, class CFGEdgeT>
typedef boost::graph_traits<CFG<CFGNodeT, CFGEdgeT> > ssa_private::CFG< CFGNodeT, CFGEdgeT >::GraphTraits

Definition at line 24 of file boostGraphCFG.h.

template<class CFGNodeT, class CFGEdgeT>
typedef CFGNodeT ssa_private::CFG< CFGNodeT, CFGEdgeT >::CFGNodeType

Definition at line 27 of file boostGraphCFG.h.

template<class CFGNodeT, class CFGEdgeT>
typedef CFGEdgeT ssa_private::CFG< CFGNodeT, CFGEdgeT >::CFGEdgeType

Definition at line 28 of file boostGraphCFG.h.

template<class CFGNodeT, class CFGEdgeT>
typedef boost::shared_ptr<CFGNodeType> ssa_private::CFG< CFGNodeT, CFGEdgeT >::CFGNodePtr

Definition at line 30 of file boostGraphCFG.h.

template<class CFGNodeT, class CFGEdgeT>
typedef boost::shared_ptr<CFGEdgeType> ssa_private::CFG< CFGNodeT, CFGEdgeT >::CFGEdgePtr

Definition at line 31 of file boostGraphCFG.h.

template<class CFGNodeT, class CFGEdgeT>
typedef GraphTraits::vertex_descriptor ssa_private::CFG< CFGNodeT, CFGEdgeT >::Vertex

Definition at line 33 of file boostGraphCFG.h.

template<class CFGNodeT, class CFGEdgeT>
typedef GraphTraits::edge_descriptor ssa_private::CFG< CFGNodeT, CFGEdgeT >::Edge

Definition at line 34 of file boostGraphCFG.h.

template<class CFGNodeT, class CFGEdgeT>
typedef std::map<Vertex, Vertex> ssa_private::CFG< CFGNodeT, CFGEdgeT >::VertexVertexMap

Definition at line 36 of file boostGraphCFG.h.

Constructor & Destructor Documentation

template<class CFGNodeT, class CFGEdgeT>
ssa_private::CFG< CFGNodeT, CFGEdgeT >::CFG ( )
inline

The default constructor.

Definition at line 61 of file boostGraphCFG.h.

template<class CFGNodeT, class CFGEdgeT>
ssa_private::CFG< CFGNodeT, CFGEdgeT >::CFG ( SgFunctionDefinition funcDef)
inlineexplicit

The constructor building the CFG.

Definition at line 69 of file boostGraphCFG.h.

References ssa_private::CFG< CFGNodeT, CFGEdgeT >::build().

Member Function Documentation

template<class CFGNodeT , class CFGEdgeT >
void ssa_private::CFG< CFGNodeT, CFGEdgeT >::build ( SgFunctionDefinition funcDef)

Build the actual CFG for the given function.

Definition at line 160 of file boostGraphCFG.h.

References SgNode::cfgForBeginning(), and isSgFunctionDefinition().

Referenced by ssa_private::CFG< CFGNodeT, CFGEdgeT >::CFG().

template<class CFGNodeT, class CFGEdgeT>
SgFunctionDefinition* ssa_private::CFG< CFGNodeT, CFGEdgeT >::getFunctionDefinition ( ) const
inline

Get the function definition of this CFG.

Definition at line 81 of file boostGraphCFG.h.

References ssa_private::CFG< CFGNodeT, CFGEdgeT >::funcDef_.

template<class CFGNodeT, class CFGEdgeT>
const Vertex& ssa_private::CFG< CFGNodeT, CFGEdgeT >::getEntry ( ) const
inline

Get the entry node of the CFG.

Definition at line 85 of file boostGraphCFG.h.

References ssa_private::CFG< CFGNodeT, CFGEdgeT >::entry_.

template<class CFGNodeT, class CFGEdgeT>
const Vertex& ssa_private::CFG< CFGNodeT, CFGEdgeT >::getExit ( ) const
inline

Get the exit node of the CFG.

Definition at line 89 of file boostGraphCFG.h.

References ssa_private::CFG< CFGNodeT, CFGEdgeT >::exit_.

template<class CFGNodeT , class CFGEdgeT >
const CFG< CFGNodeT, CFGEdgeT >::VertexVertexMap & ssa_private::CFG< CFGNodeT, CFGEdgeT >::getDominatorTree ( )

Build the dominator tree of this CFG.

Returns
A map from each node to its immediate dominator.

Definition at line 276 of file boostGraphCFG.h.

template<class CFGNodeT , class CFGEdgeT >
const CFG< CFGNodeT, CFGEdgeT >::VertexVertexMap & ssa_private::CFG< CFGNodeT, CFGEdgeT >::getPostdominatorTree ( )

Build the postdominator tree of this CFG.

Definition at line 289 of file boostGraphCFG.h.

template<class CFGNodeT , class CFGEdgeT >
CFG< CFGNodeT, CFGEdgeT > ssa_private::CFG< CFGNodeT, CFGEdgeT >::makeReverseCopy ( ) const
template<class CFGNodeT , class CFGEdgeT >
std::vector< typename CFG< CFGNodeT, CFGEdgeT >::CFGNodePtr > ssa_private::CFG< CFGNodeT, CFGEdgeT >::getAllNodes ( ) const

Get all CFG nodes in this graph.

Definition at line 318 of file boostGraphCFG.h.

template<class CFGNodeT , class CFGEdgeT >
std::vector< typename CFG< CFGNodeT, CFGEdgeT >::CFGEdgePtr > ssa_private::CFG< CFGNodeT, CFGEdgeT >::getAllEdges ( ) const

Get all CFG edges in this graph.

Definition at line 328 of file boostGraphCFG.h.

template<class CFGNodeT , class CFGEdgeT >
CFG< CFGNodeT, CFGEdgeT >::Vertex ssa_private::CFG< CFGNodeT, CFGEdgeT >::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 337 of file boostGraphCFG.h.

template<class CFGNodeT , class CFGEdgeT >
std::vector< typename CFG< CFGNodeT, CFGEdgeT >::Edge > ssa_private::CFG< CFGNodeT, CFGEdgeT >::getAllBackEdges ( )

Get all back edges in the CFG. A back edge is one whose target dominates its source.

Definition at line 350 of file boostGraphCFG.h.

template<class CFGNodeT , class CFGEdgeT >
std::vector< typename CFG< CFGNodeT, CFGEdgeT >::Vertex > ssa_private::CFG< CFGNodeT, CFGEdgeT >::getAllLoopHeaders ( )

Get all loop headers in this CFG. A natural loop only has one header.

Definition at line 379 of file boostGraphCFG.h.

template<class CFGNodeT , class CFGEdgeT >
void ssa_private::CFG< CFGNodeT, CFGEdgeT >::buildCFG ( const CFGNodeType node,
std::map< CFGNodeType, Vertex > &  nodesAdded,
std::set< CFGNodeType > &  nodesProcessed 
)
protected

A internal funtion which builds the actual CFG (boost::graph).

Definition at line 213 of file boostGraphCFG.h.

References StaticCFG::outEdges().

template<class CFGNodeT , class CFGEdgeT >
void ssa_private::CFG< CFGNodeT, CFGEdgeT >::setEntryAndExit ( )
protected

Find the entry and exit of this CFG and set the corresponding members.

Definition at line 184 of file boostGraphCFG.h.

References isSgFunctionDefinition().

Member Data Documentation

template<class CFGNodeT, class CFGEdgeT>
SgFunctionDefinition* ssa_private::CFG< CFGNodeT, CFGEdgeT >::funcDef_
protected

The function definition of this CFG.

Definition at line 41 of file boostGraphCFG.h.

Referenced by ssa_private::CFG< CFGNodeT, CFGEdgeT >::getFunctionDefinition().

template<class CFGNodeT, class CFGEdgeT>
Vertex ssa_private::CFG< CFGNodeT, CFGEdgeT >::entry_
protected
template<class CFGNodeT, class CFGEdgeT>
Vertex ssa_private::CFG< CFGNodeT, CFGEdgeT >::exit_
protected
template<class CFGNodeT, class CFGEdgeT>
std::map<CFGNodeType, Vertex> ssa_private::CFG< CFGNodeT, CFGEdgeT >::nodesToVertices_
protected

A map from a CFG node to the corresponding vertex.

Definition at line 50 of file boostGraphCFG.h.

template<class CFGNodeT, class CFGEdgeT>
VertexVertexMap ssa_private::CFG< CFGNodeT, CFGEdgeT >::dominatorTree_
protected

The dominator tree of this CFG.

Definition at line 53 of file boostGraphCFG.h.

template<class CFGNodeT, class CFGEdgeT>
VertexVertexMap ssa_private::CFG< CFGNodeT, CFGEdgeT >::postdominatorTree_
protected

The postdominator tree of this CFG.

Definition at line 56 of file boostGraphCFG.h.


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