ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VirtualCFG Namespace Reference

Classes

class  FilteredCFGEdge
 
class  FilteredCFGNode
 
struct  MakeClosure
 
class  CfgToDotImpl
 
class  CFGNode
 A node in the control flow graph. More...
 
class  CFGEdge
 A control flow edge connecting two CFG nodes, with an edge condition to indicate edge types. More...
 
class  CFGPath
 
class  InterestingNode
 
class  InterestingEdge
 
class  cfgRWTransaction
 
class  DataflowNode
 
class  DataflowEdge
 
class  iterator
 
class  back_iterator
 
class  dataflow
 
class  back_dataflow
 

Typedefs

typedef void(* CFGTransform )(SgNode *target, SgNode *newNode, void *data)
 
typedef std::map< SgNode
*, DataflowNode
m_AST2CFG
 

Enumerations

enum  EdgeConditionKind {
  eckUnconditional,
  eckTrue,
  eckFalse,
  eckCaseLabel,
  eckDefault,
  eckDoConditionPassed,
  eckDoConditionFailed,
  eckForallIndicesInRange,
  eckForallIndicesNotInRange,
  eckComputedGotoCaseLabel,
  eckArithmeticIfLess,
  eckArithmeticIfEqual,
  eckArithmeticIfGreater,
  eckInterprocedural
}
 The conditions attached to edges are marked to determine which conditions trigger control to flow along that edge (as opposed to other edges out of the same source node). More...
 

Functions

ROSE_DLL_API std::ostream & cfgToDot (std::ostream &o, std::string graphName, CFGNode start)
 
ROSE_DLL_API std::ostream & cfgToDot (std::ostream &o, std::string graphName, InterestingNode start)
 
ROSE_DLL_API std::ostream & cfgToDotForDebugging (std::ostream &o, std::string graphName, CFGNode start)
 
ROSE_DLL_API std::ostream & cfgToDotForDebugging (std::ostream &o, std::string graphName, InterestingNode start)
 
ROSE_DLL_API void cfgToDot (SgNode *start, const std::string &file_name)
 Dump the filtered dot graph of a virtual control flow graph starting from SgNode (start) More...
 
ROSE_DLL_API void interestingCfgToDot (SgNode *start, const std::string &file_name)
 Dump a CFG with only interesting nodes for a SgNode. More...
 
ROSE_DLL_API void cfgToDotForDebugging (SgNode *start, const std::string &file_name)
 Dump the full dot graph of a virtual control flow graph starting from SgNode (start) More...
 
template<typename FilterFunction >
std::ostream & cfgToDot (std::ostream &o, std::string graphName, FilteredCFGNode< FilterFunction > start)
 
template<typename FilteredEdge , typename FindSuccessors , typename FindEnd , typename AddChildren , typename Join >
std::vector< FilteredEdge > makeClosure (const std::vector< CFGPath > &p, const FindSuccessors &findSuccessors, const FindEnd &findEnd, const AddChildren &addChildren, const Join &join)
 
template<typename FilteredEdge , typename Filter >
std::vector< FilteredEdge > makeClosure (const std::vector< CFGEdge > &orig, std::vector< CFGEdge >(CFGNode::*closure)() const, CFGNode(CFGPath::*otherSide)() const, CFGPath(*merge)(const CFGPath &, const CFGPath &), const Filter &filter)
 
template<typename NodeT >
void printNode (std::ostream &o, const NodeT &n)
 Helper function to print Node information. More...
 
template<typename EdgeT >
void printEdge (std::ostream &o, const EdgeT &e, bool isInEdge)
 Edge printer. More...
 
template<typename NodeT , typename EdgeT >
void printNodePlusEdges (std::ostream &o, NodeT n)
 Print out a node plus all its outgoing edges. More...
 
CFGPath mergePaths (const CFGPath &hd, const CFGPath &tl)
 
CFGPath mergePathsReversed (const CFGPath &tl, const CFGPath &hd)
 
CFGNode cfgBeginningOfConstruct (SgNode *c)
 The first CFG node for a construct (before the construct starts to execute) More...
 
unsigned int cfgIndexForEndWrapper (SgNode *n)
 
CFGNode cfgEndOfConstruct (SgNode *c)
 The last CFG node for a construct (after the entire construct has finished executing). More...
 
CFGNode makeCfg (SgNode *start)
 Returns CFG node for just before start. More...
 
InterestingNode makeInterestingCfg (SgNode *start)
 
CFGNode getCFGTargetOfFortranLabelSymbol (SgLabelSymbol *sym)
 
CFGNode getCFGTargetOfFortranLabelRef (SgLabelRefExp *lRef)
 
template<class Node1T , class Node2T , class EdgeT >
void makeEdge (Node1T from, Node2T to, std::vector< EdgeT > &result)
 Utility function to make CFG Edges. More...
 
void initCFGRewrite (SgProject *project)
 void insertAfterCFG(DataflowNode cfgNode, SgProject project); More...
 
bool isNonMutatingOperator (SgNode *n)
 
bool isNonMutatingSubTree (SgNode *n)
 
void replaceExpressionChecked (SgNode *parent, SgExpression *from, SgExpression *to)
 
void replaceStatement (SgNode *parent, SgStatement *from, SgStatement *to)
 
Sg_File_InfogetFileInfo (SgNode *n)
 
std::string getFileInfoString (SgNode *n)
 
std::string getFileInfoString (CFGNode n)
 
CFGNode theInEdge (CFGNode n)
 
CFGNode theOutEdge (CFGNode n)
 
SgExpressioninsertBeforeExpression (SgExpression *expr, SgExpression *newNode)
 
SgExpressioninsertAfterExpression (SgExpression *expr, SgExpression *newNode)
 
void replaceStatementByBlockBefore (SgStatement *stmt, SgStatement *newNode)
 
void replaceStatementByBlockAfter (SgStatement *stmt, SgStatement *newNode)
 
void createTmpVarInit (SgType *varType, std::string newName, bool byReference, SgName &varName, SgInitializedName *&initName, SgType *&newType, SgVariableDeclaration *&varDecl)
 
SgStatementcreateFuncCallStmt (SgFunctionDeclaration *funcDecl)
 
SgVariableSymbolvarSymFromInitName (SgInitializedName *initName)
 
SgVarRefExpvarRefFromInitName (SgInitializedName *initName)
 
SgAssignOpreplaceExprWithAssignOp (SgExpression *orig, SgVarRefExp *lhsVar)
 
void insertVarDecl (SgStatement *anchor, SgType *varType, bool before, SgInitializedName *&initName)
 
void insertAroundForInit (SgVariableDeclaration *n, SgExpression *newNode, bool before)
 
void prependToScopeStmt (SgNode *target, SgNode *newNode, void *data)
 
void appendToScopeStmt (SgNode *target, SgNode *newNode, void *data)
 
bool defaultFilter (CFGNode cfgn)
 
DataflowNode makeDataflowCfg (SgNode *start, bool(*f)(CFGNode))
 
bool isDataflowInteresting (CFGNode cn)
 
template<typename FilterFunction >
ROSE_DLL_API std::ostream & dfaToDot (std::ostream &o, std::string graphName, std::vector< FilteredCFGNode< FilterFunction > > start, DefUseAnalysis *dfa)
 
template<typename FilterFunction >
ROSE_DLL_API std::ostream & dfaToDot (std::ostream &o, std::string graphName, std::vector< FilteredCFGNode< FilterFunction > > start, DefUseAnalysis *dfa, LivenessAnalysis *live)
 

Variables

int efgh
 

Typedef Documentation

typedef void(* VirtualCFG::CFGTransform)(SgNode *target, SgNode *newNode, void *data)

Definition at line 101 of file CFGRewrite.h.

Definition at line 42 of file DataflowCFG.h.

Enumeration Type Documentation

The conditions attached to edges are marked to determine which conditions trigger control to flow along that edge (as opposed to other edges out of the same source node).

For conditional branches (except eckCaseLabel and eckDefault), the conditions are implicit and depend on knowledge of the particular control structure. Fortran support for this is underdeveloped; single AST nodes representing variable-length loops was not part of the original design of the CFG code.

Enumerator
eckUnconditional 
eckTrue 

Normal, unconditional edge.

eckFalse 

True case of a two-way branch.

eckCaseLabel 

False case of a two-way branch.

eckDefault 

Case label (constant is given by caseLabel())

eckDoConditionPassed 

Default label.

eckDoConditionFailed 

Enter Fortran do loop body.

eckForallIndicesInRange 

Fortran do loop finished.

eckForallIndicesNotInRange 

Start testing forall mask.

eckComputedGotoCaseLabel 

End of forall loop.

eckArithmeticIfLess 

Case in computed goto – number needs to be computed separately.

eckArithmeticIfEqual 

Edge for the arithmetic if expression being less than zero.

eckArithmeticIfGreater 

Edge for the arithmetic if expression being equal to zero.

eckInterprocedural 

Edge for the arithmetic if expression being greater than zero.

Edge spanning two procedures

Definition at line 47 of file virtualCFG.h.

Function Documentation

ROSE_DLL_API std::ostream& VirtualCFG::cfgToDot ( std::ostream &  o,
std::string  graphName,
CFGNode  start 
)
ROSE_DLL_API std::ostream& VirtualCFG::cfgToDot ( std::ostream &  o,
std::string  graphName,
InterestingNode  start 
)
ROSE_DLL_API std::ostream& VirtualCFG::cfgToDotForDebugging ( std::ostream &  o,
std::string  graphName,
CFGNode  start 
)
ROSE_DLL_API std::ostream& VirtualCFG::cfgToDotForDebugging ( std::ostream &  o,
std::string  graphName,
InterestingNode  start 
)
ROSE_DLL_API void VirtualCFG::cfgToDot ( SgNode start,
const std::string &  file_name 
)

Dump the filtered dot graph of a virtual control flow graph starting from SgNode (start)

ROSE_DLL_API void VirtualCFG::interestingCfgToDot ( SgNode start,
const std::string &  file_name 
)

Dump a CFG with only interesting nodes for a SgNode.

ROSE_DLL_API void VirtualCFG::cfgToDotForDebugging ( SgNode start,
const std::string &  file_name 
)

Dump the full dot graph of a virtual control flow graph starting from SgNode (start)

template<typename FilterFunction >
std::ostream & VirtualCFG::cfgToDot ( std::ostream &  o,
std::string  graphName,
FilteredCFGNode< FilterFunction >  start 
)
template<typename FilteredEdge , typename FindSuccessors , typename FindEnd , typename AddChildren , typename Join >
std::vector< FilteredEdge > VirtualCFG::makeClosure ( const std::vector< CFGPath > &  p,
const FindSuccessors &  findSuccessors,
const FindEnd &  findEnd,
const AddChildren &  addChildren,
const Join &  join 
)
template<typename FilteredEdge , typename Filter >
std::vector< FilteredEdge > VirtualCFG::makeClosure ( const std::vector< CFGEdge > &  orig,
std::vector< CFGEdge >(CFGNode::*)() const  closure,
CFGNode(CFGPath::*)() const  otherSide,
CFGPath(*)(const CFGPath &, const CFGPath &)  merge,
const Filter &  filter 
)

Definition at line 104 of file filteredCFGImpl.h.

References paths.

template<typename NodeT >
void VirtualCFG::printNode ( std::ostream &  o,
const NodeT &  n 
)
inline

Helper function to print Node information.

Definition at line 159 of file filteredCFGImpl.h.

References escapeString(), isSgExpression(), isSgInitializedName(), and isSgStatement().

Referenced by printNodePlusEdges().

template<typename EdgeT >
void VirtualCFG::printEdge ( std::ostream &  o,
const EdgeT &  e,
bool  isInEdge 
)
inline

Edge printer.

Definition at line 176 of file filteredCFGImpl.h.

References escapeString().

Referenced by printNodePlusEdges().

template<typename NodeT , typename EdgeT >
void VirtualCFG::printNodePlusEdges ( std::ostream &  o,
NodeT  n 
)

Print out a node plus all its outgoing edges.

Definition at line 218 of file filteredCFGImpl.h.

References StaticCFG::inEdges(), StaticCFG::outEdges(), printEdge(), and printNode().

CFGPath VirtualCFG::mergePaths ( const CFGPath &  hd,
const CFGPath &  tl 
)
inline

Merge two CFG paths

Definition at line 243 of file virtualCFG.h.

Referenced by mergePathsReversed(), and VirtualCFG::FilteredCFGNode< FilterFunction >::outEdges().

CFGPath VirtualCFG::mergePathsReversed ( const CFGPath &  tl,
const CFGPath &  hd 
)
inline

mergePaths() with the arguments reversed

Definition at line 249 of file virtualCFG.h.

References mergePaths().

Referenced by VirtualCFG::FilteredCFGNode< FilterFunction >::inEdges().

CFGNode VirtualCFG::cfgBeginningOfConstruct ( SgNode c)
inline

The first CFG node for a construct (before the construct starts to execute)

Definition at line 255 of file virtualCFG.h.

Referenced by makeCfg(), makeDataflowCfg(), and makeInterestingCfg().

unsigned int VirtualCFG::cfgIndexForEndWrapper ( SgNode n)

Non-member wrapper for SgNode::cfgIndexForEnd since that has not yet been defined

Referenced by cfgEndOfConstruct().

CFGNode VirtualCFG::cfgEndOfConstruct ( SgNode c)
inline

The last CFG node for a construct (after the entire construct has finished executing).

This node may not actually be reached if, for example, a goto causes a loop to be exited in the middle

Definition at line 266 of file virtualCFG.h.

References cfgIndexForEndWrapper().

CFGNode VirtualCFG::makeCfg ( SgNode start)
inline

Returns CFG node for just before start.

Definition at line 271 of file virtualCFG.h.

References cfgBeginningOfConstruct().

InterestingNode VirtualCFG::makeInterestingCfg ( SgNode start)
inline

Definition at line 317 of file virtualCFG.h.

References cfgBeginningOfConstruct().

CFGNode VirtualCFG::getCFGTargetOfFortranLabelSymbol ( SgLabelSymbol sym)

Get the CFG node for a Fortran label from its symbol

CFGNode VirtualCFG::getCFGTargetOfFortranLabelRef ( SgLabelRefExp lRef)

Get the CFG node for a Fortran label from a reference to it

template<class Node1T , class Node2T , class EdgeT >
void VirtualCFG::makeEdge ( Node1T  from,
Node2T  to,
std::vector< EdgeT > &  result 
)

Utility function to make CFG Edges.

void VirtualCFG::initCFGRewrite ( SgProject project)

void insertAfterCFG(DataflowNode cfgNode, SgProject project);

bool VirtualCFG::isNonMutatingOperator ( SgNode n)
bool VirtualCFG::isNonMutatingSubTree ( SgNode n)
void VirtualCFG::replaceExpressionChecked ( SgNode parent,
SgExpression from,
SgExpression to 
)
void VirtualCFG::replaceStatement ( SgNode parent,
SgStatement from,
SgStatement to 
)
Sg_File_Info* VirtualCFG::getFileInfo ( SgNode n)
std::string VirtualCFG::getFileInfoString ( SgNode n)
std::string VirtualCFG::getFileInfoString ( CFGNode  n)
CFGNode VirtualCFG::theInEdge ( CFGNode  n)
CFGNode VirtualCFG::theOutEdge ( CFGNode  n)
SgExpression* VirtualCFG::insertBeforeExpression ( SgExpression expr,
SgExpression newNode 
)
SgExpression* VirtualCFG::insertAfterExpression ( SgExpression expr,
SgExpression newNode 
)
void VirtualCFG::replaceStatementByBlockBefore ( SgStatement stmt,
SgStatement newNode 
)
void VirtualCFG::replaceStatementByBlockAfter ( SgStatement stmt,
SgStatement newNode 
)
void VirtualCFG::createTmpVarInit ( SgType varType,
std::string  newName,
bool  byReference,
SgName varName,
SgInitializedName *&  initName,
SgType *&  newType,
SgVariableDeclaration *&  varDecl 
)
SgStatement* VirtualCFG::createFuncCallStmt ( SgFunctionDeclaration funcDecl)
SgVariableSymbol* VirtualCFG::varSymFromInitName ( SgInitializedName initName)
SgVarRefExp* VirtualCFG::varRefFromInitName ( SgInitializedName initName)
SgAssignOp* VirtualCFG::replaceExprWithAssignOp ( SgExpression orig,
SgVarRefExp lhsVar 
)
void VirtualCFG::insertVarDecl ( SgStatement anchor,
SgType varType,
bool  before,
SgInitializedName *&  initName 
)
void VirtualCFG::insertAroundForInit ( SgVariableDeclaration n,
SgExpression newNode,
bool  before 
)
void VirtualCFG::prependToScopeStmt ( SgNode target,
SgNode newNode,
void *  data 
)
void VirtualCFG::appendToScopeStmt ( SgNode target,
SgNode newNode,
void *  data 
)
bool VirtualCFG::defaultFilter ( CFGNode  cfgn)
DataflowNode VirtualCFG::makeDataflowCfg ( SgNode start,
bool(*)(CFGNode f 
)
inline

Definition at line 69 of file DataflowCFG.h.

References cfgBeginningOfConstruct().

bool VirtualCFG::isDataflowInteresting ( CFGNode  cn)
template<typename FilterFunction >
ROSE_DLL_API std::ostream& VirtualCFG::dfaToDot ( std::ostream &  o,
std::string  graphName,
std::vector< FilteredCFGNode< FilterFunction > >  start,
DefUseAnalysis dfa 
)
template<typename FilterFunction >
ROSE_DLL_API std::ostream& VirtualCFG::dfaToDot ( std::ostream &  o,
std::string  graphName,
std::vector< FilteredCFGNode< FilterFunction > >  start,
DefUseAnalysis dfa,
LivenessAnalysis live 
)

Variable Documentation

int VirtualCFG::efgh