ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DominatorTreesAndDominanceFrontiers::TemplatedDominatorTree< CFGFilterFunction > Class Template Reference

TemplatedDominatorTree constructs a dominator/postdominator tree for a cfg. For the template parameter any cfg following Jeremias interface may be used. More...

#include <DominatorTree.h>

Inheritance diagram for DominatorTreesAndDominanceFrontiers::TemplatedDominatorTree< CFGFilterFunction >:
Collaboration diagram for DominatorTreesAndDominanceFrontiers::TemplatedDominatorTree< CFGFilterFunction >:

Public Member Functions

void writeDot (char *filename)
 writes the DT in DOT-notation to the file given in filename More...
 
 TemplatedDominatorTree (SgNode *head, Direction d=DominatorForwardBackwardWrapperClass< CFGFilterFunction >::PRE_DOMINATOR)
 constructor for the DT. Head is the start point for the DT construction. DT works for SgFunctionDefintion nodes, unexpected behaviour for non-SgFunctionDefinition!!! More...
 
int getSize ()
 
std::set< int > getDirectDominatedSet (int nodeID)
 returns the set of nodes directly dominated by nodeID More...
 
int getImDomID (int i)
 
int getImDomID (VirtualCFG::FilteredCFGNode< CFGFilterFunction > node)
 get the ImDomID for given SgNode, returns negative for non-cfg-node More...
 
bool dominates (int a, int b)
 calculates if a dominates b, i.e. a is on the path from b to the root More...
 
bool dominates (VirtualCFG::FilteredCFGNode< CFGFilterFunction > a, VirtualCFG::FilteredCFGNode< CFGFilterFunction > b)
 returns true if node a dominates node b, see dominates(int a,int b) More...
 
VirtualCFG::FilteredCFGNode
< CFGFilterFunction > 
getCFGNodeFromID (unsigned int id)
 
int getID (VirtualCFG::FilteredCFGNode< CFGFilterFunction > node)
 
- Public Member Functions inherited from DominatorTreesAndDominanceFrontiers::DominatorForwardBackwardWrapperClass< CFGFilterFunction >
 DominatorForwardBackwardWrapperClass (Direction dir)
 
Direction getDirection ()
 

Private Member Functions

void init ()
 inits the internal structures for idom calculation More...
 
void depthFirstSearch ()
 create the dfs-order of the cfg More...
 
void calculateImmediateDominators ()
 calculate immediate dominators More...
 
int eval (int)
 helperfunction according to lingauer&tarjan More...
 
void link (int source, int target)
 create the forrest of parents More...
 
void printInfo ()
 debug output More...
 

Private Attributes

VirtualCFG::FilteredCFGNode
< CFGFilterFunction > 
cfgRoot
 
std::vector
< VirtualCFG::FilteredCFGNode
< CFGFilterFunction > > 
idToNode
 
std::map
< VirtualCFG::FilteredCFGNode
< CFGFilterFunction >, int > 
nodeToIdMap
 
std::vector< int > semi
 internal variables More...
 
std::vector< int > idom
 
std::vector< int > ancestor
 
std::vector< int > dfsParent
 
std::vector< std::set< int > > buckets
 

Additional Inherited Members

- Protected Member Functions inherited from DominatorTreesAndDominanceFrontiers::DominatorForwardBackwardWrapperClass< CFGFilterFunction >
std::vector
< VirtualCFG::FilteredCFGEdge
< CFGFilterFunction > > 
getDirectionModifiedOutEdges (VirtualCFG::FilteredCFGNode< CFGFilterFunction > current)
 helperfunctions to toggle beween pre and post dominator tree More...
 
std::vector
< VirtualCFG::FilteredCFGEdge
< CFGFilterFunction > > 
getDirectionModifiedInEdges (VirtualCFG::FilteredCFGNode< CFGFilterFunction > current)
 
VirtualCFG::FilteredCFGNode
< CFGFilterFunction > 
target (VirtualCFG::FilteredCFGEdge< CFGFilterFunction > outedge)
 
VirtualCFG::FilteredCFGNode
< CFGFilterFunction > 
source (VirtualCFG::FilteredCFGEdge< CFGFilterFunction > outedge)
 
- Protected Attributes inherited from DominatorTreesAndDominanceFrontiers::DominatorForwardBackwardWrapperClass< CFGFilterFunction >
Direction treeDirection
 

Detailed Description

template<typename CFGFilterFunction>
class DominatorTreesAndDominanceFrontiers::TemplatedDominatorTree< CFGFilterFunction >

TemplatedDominatorTree constructs a dominator/postdominator tree for a cfg. For the template parameter any cfg following Jeremias interface may be used.

Definition at line 80 of file dominanceAnalysis/DominatorTree.h.

Constructor & Destructor Documentation

template<typename CFGFilterFunction >
DominatorTreesAndDominanceFrontiers::TemplatedDominatorTree< CFGFilterFunction >::TemplatedDominatorTree ( SgNode head,
Direction  d = DominatorForwardBackwardWrapperClass <CFGFilterFunction>::PRE_DOMINATOR 
)

constructor for the DT. Head is the start point for the DT construction. DT works for SgFunctionDefintion nodes, unexpected behaviour for non-SgFunctionDefinition!!!

initialize cfg0root correctly

Definition at line 28 of file DominatorTreeImpl.h.

References Dbg::init().

Member Function Documentation

template<typename CFGFilterFunction >
void DominatorTreesAndDominanceFrontiers::TemplatedDominatorTree< CFGFilterFunction >::writeDot ( char *  filename)

writes the DT in DOT-notation to the file given in filename

Definition at line 8 of file DominatorTreeImpl.h.

References escapeString(), and OmpSupport::toString().

template<typename CFGFilterFunction>
int DominatorTreesAndDominanceFrontiers::TemplatedDominatorTree< CFGFilterFunction >::getSize ( )
inline
template<typename CFGFilterFunction>
std::set<int> DominatorTreesAndDominanceFrontiers::TemplatedDominatorTree< CFGFilterFunction >::getDirectDominatedSet ( int  nodeID)
inline

returns the set of nodes directly dominated by nodeID

Definition at line 108 of file dominanceAnalysis/DominatorTree.h.

References DominatorTreesAndDominanceFrontiers::TemplatedDominatorTree< CFGFilterFunction >::idom.

template<typename CFGFilterFunction>
int DominatorTreesAndDominanceFrontiers::TemplatedDominatorTree< CFGFilterFunction >::getImDomID ( VirtualCFG::FilteredCFGNode< CFGFilterFunction >  node)
inline
template<typename CFGFilterFunction>
bool DominatorTreesAndDominanceFrontiers::TemplatedDominatorTree< CFGFilterFunction >::dominates ( int  a,
int  b 
)
inline
template<typename CFGFilterFunction>
bool DominatorTreesAndDominanceFrontiers::TemplatedDominatorTree< CFGFilterFunction >::dominates ( VirtualCFG::FilteredCFGNode< CFGFilterFunction >  a,
VirtualCFG::FilteredCFGNode< CFGFilterFunction >  b 
)
inline
template<typename CFGFilterFunction >
void DominatorTreesAndDominanceFrontiers::TemplatedDominatorTree< CFGFilterFunction >::init ( )
private

inits the internal structures for idom calculation

Definition at line 120 of file DominatorTreeImpl.h.

References sg::ancestor().

template<typename CFGFilterFunction >
void DominatorTreesAndDominanceFrontiers::TemplatedDominatorTree< CFGFilterFunction >::depthFirstSearch ( )
private

create the dfs-order of the cfg

Definition at line 40 of file DominatorTreeImpl.h.

References sg::ancestor(), StaticCFG::outEdges(), and VirtualCFG::FilteredCFGNode< FilterFunction >::toString().

template<typename CFGFilterFunction >
void DominatorTreesAndDominanceFrontiers::TemplatedDominatorTree< CFGFilterFunction >::calculateImmediateDominators ( )
private

calculate immediate dominators

Definition at line 209 of file DominatorTreeImpl.h.

template<typename CFGFilterFunction >
int DominatorTreesAndDominanceFrontiers::TemplatedDominatorTree< CFGFilterFunction >::eval ( int  node)
private

helperfunction according to lingauer&tarjan

Definition at line 105 of file DominatorTreeImpl.h.

References sg::ancestor().

template<typename CFGFilterFunction >
void DominatorTreesAndDominanceFrontiers::TemplatedDominatorTree< CFGFilterFunction >::link ( int  source,
int  target 
)
private

create the forrest of parents

the preformance of the DT-algorithm can be improved by implementing a tree-averaging/redistributing algorithm in eval or link, usually it is done in eval

Definition at line 99 of file DominatorTreeImpl.h.

References sg::ancestor().

Member Data Documentation

template<typename CFGFilterFunction>
std::map< VirtualCFG::FilteredCFGNode < CFGFilterFunction >, int > DominatorTreesAndDominanceFrontiers::TemplatedDominatorTree< CFGFilterFunction >::nodeToIdMap
private
template<typename CFGFilterFunction>
std::vector< int > DominatorTreesAndDominanceFrontiers::TemplatedDominatorTree< CFGFilterFunction >::semi
private
template<typename CFGFilterFunction>
std::vector< int > DominatorTreesAndDominanceFrontiers::TemplatedDominatorTree< CFGFilterFunction >::ancestor
private
template<typename CFGFilterFunction>
std::vector< int > DominatorTreesAndDominanceFrontiers::TemplatedDominatorTree< CFGFilterFunction >::dfsParent
private

Definition at line 212 of file dominanceAnalysis/DominatorTree.h.

template<typename CFGFilterFunction>
std::vector< std::set < int > > DominatorTreesAndDominanceFrontiers::TemplatedDominatorTree< CFGFilterFunction >::buckets
private

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