ROSE
0.9.6a
|
#include <ControlFlowGraph.h>
Public Types | |
enum | ID_dir { FORWARD, BACKWARD, FORWARD, BACKWARD } |
determines the ordering of id numbers More... | |
enum | ID_dir { FORWARD, BACKWARD, FORWARD, BACKWARD } |
determines the ordering of id numbers More... | |
Public Types inherited from SimpleDirectedGraph | |
enum | TraverseDirection { FORWARD = 1, BACKWARD = 2, FORWARD = 1, BACKWARD = 2 } |
This enum determines which direction to travel during a reachability pass. More... | |
enum | TraverseDirection { FORWARD = 1, BACKWARD = 2, FORWARD = 1, BACKWARD = 2 } |
This enum determines which direction to travel during a reachability pass. More... | |
Public Member Functions | |
ControlFlowGraph (SgNode *head) | |
The constructor for ControlFlowGraph. Builds a CFG rooted at head. More... | |
void | createNode (CFGNodeImpl *node) |
from a given CFGImpl node, create one (or more) ControlNodes More... | |
int | getSize () |
return the number of nodes in the CFG More... | |
ControlNode * | getNode (int id, ID_dir dir) |
given a node id (and which numbering scheme to use), return the appropriate control node More... | |
void | outputCFGImpl () |
dump the contents of the original CFGImpl to a dot file More... | |
ControlFlowGraph (SgNode *head) | |
The constructor for ControlFlowGraph. Builds a CFG rooted at head. More... | |
void | createNode (CFGNodeImpl *node) |
from a given CFGImpl node, create one (or more) ControlNodes More... | |
int | getSize () |
return the number of nodes in the CFG More... | |
ControlNode * | getNode (int id, ID_dir dir) |
given a node id (and which numbering scheme to use), return the appropriate control node More... | |
void | outputCFGImpl () |
dump the contents of the original CFGImpl to a dot file More... | |
Public Member Functions inherited from SimpleDirectedGraph | |
~SimpleDirectedGraph () | |
std::set < SimpleDirectedGraphNode * > | getNodes () |
get all the nodes in the graph More... | |
virtual void | addNode (SimpleDirectedGraphNode *node) |
Add a node to the graph. More... | |
virtual void | addLink (SimpleDirectedGraphNode *from, SimpleDirectedGraphNode *to) |
Add a link to the graph between "from" and to "to". More... | |
bool | nodeExists (SimpleDirectedGraphNode *node) |
Check if a node containing data is in the graph. More... | |
bool | linkExists (SimpleDirectedGraphNode *from, SimpleDirectedGraphNode *to) |
Check if a dependence is in the graph. More... | |
void | printGraph () |
virtual void | writeDot (char *filename) |
std::set < SimpleDirectedGraphNode * > | getReachable (SimpleDirectedGraphNode *start, TraverseDirection dir) |
SimpleDirectedGraph () | |
virtual | ~SimpleDirectedGraph () |
std::set < SimpleDirectedGraphNode * > | getNodes () |
get all the nodes in the graph More... | |
virtual void | addNode (SimpleDirectedGraphNode *node) |
Add a node to the graph. More... | |
virtual void | removeNode (SimpleDirectedGraphNode *node) |
virtual void | removeLink (SimpleDirectedGraphNode *from, SimpleDirectedGraphNode *to) |
Remove a linkt between "from" and "to". More... | |
virtual void | addLink (SimpleDirectedGraphNode *from, SimpleDirectedGraphNode *to) |
Add a link to the graph between "from" and to "to". More... | |
bool | nodeExists (SimpleDirectedGraphNode *node) |
Check if a node containing data is in the graph. More... | |
bool | linkExists (SimpleDirectedGraphNode *from, SimpleDirectedGraphNode *to) |
Check if a dependence is in the graph. More... | |
void | printGraph () |
virtual void | writeDot (char *filename) |
std::set < SimpleDirectedGraphNode * > | getReachable (SimpleDirectedGraphNode *start, TraverseDirection dir) |
Private Member Functions | |
void | _buildCFGImpl (SgNode *head) |
void | _buildCFG () |
void | _buildBranches (ControlNode *from, CFGNodeImpl *curr) |
void | _setupIDs (ID_dir) |
virtual void | _displayData (SimpleDirectedGraphNode *data, std::ostream &os) |
void | _buildCFGImpl (SgNode *head) |
void | _buildCFG () |
void | _buildBranches (ControlNode *from, CFGNodeImpl *curr) |
void | _setupIDs (ID_dir) |
virtual void | _displayData (SimpleDirectedGraphNode *data, std::ostream &os) |
Private Attributes | |
DefaultCFGImpl * | _cfg |
int | _numNodes |
ControlNode * | _entry |
ControlNode * | _exit |
std::map< CFGNodeImpl *, ControlNode * > | _cfgnodemap |
Map from CFGImpl nodes to our ControlNodes (used for empty CFGNodeImpls) More... | |
std::map< SgNode *, ControlNode * > | _sgnodemap |
Map from SgNodes to ControlNodes (used for ControlNodes with statements) More... | |
ControlNode ** | _forIndex |
Array matches IDs to ControlNodes using forward ids. More... | |
ControlNode ** | _backIndex |
Array matches IDs to ControlNodes using backward ids. More... | |
Additional Inherited Members | |
Protected Attributes inherited from SimpleDirectedGraph | |
std::set < SimpleDirectedGraphNode * > | _nodes |
This class constructs a control flow graph for a given function definition. It builds off of information provided by CFGImpl.h, and adds some additional bookkeeping information (such as entry and exit points, as well as having a separate node for each statement in the graph).
This class extends SimpleDirectedGraph templated on ControlNode
Definition at line 40 of file dominatorTreesAndDominanceFrontiers/ControlFlowGraph.h.
determines the ordering of id numbers
Certain uses of the CFG rely on a specific numbering scheme for the nodes of the CFG. The nodes can either be numbered in breadth-first-search order rooted at the entry node, and following edges forward, or in breadth-first-search order rooted at the exit node and following edges backward.
Enumerator | |
---|---|
FORWARD | |
BACKWARD | |
FORWARD | |
BACKWARD |
Definition at line 52 of file dominatorTreesAndDominanceFrontiers/ControlFlowGraph.h.
determines the ordering of id numbers
Certain uses of the CFG rely on a specific numbering scheme for the nodes of the CFG. The nodes can either be numbered in breadth-first-search order rooted at the entry node, and following edges forward, or in breadth-first-search order rooted at the exit node and following edges backward.
Enumerator | |
---|---|
FORWARD | |
BACKWARD | |
FORWARD | |
BACKWARD |
Definition at line 52 of file staticInterproceduralSlicing/ControlFlowGraph.h.
DominatorTreesAndDominanceFrontiers::ControlFlowGraph::ControlFlowGraph | ( | SgNode * | head) |
The constructor for ControlFlowGraph. Builds a CFG rooted at head.
DominatorTreesAndDominanceFrontiers::ControlFlowGraph::ControlFlowGraph | ( | SgNode * | head) |
The constructor for ControlFlowGraph. Builds a CFG rooted at head.
void DominatorTreesAndDominanceFrontiers::ControlFlowGraph::createNode | ( | CFGNodeImpl * | node) |
from a given CFGImpl node, create one (or more) ControlNodes
|
inline |
return the number of nodes in the CFG
Definition at line 65 of file dominatorTreesAndDominanceFrontiers/ControlFlowGraph.h.
References _numNodes.
|
inline |
given a node id (and which numbering scheme to use), return the appropriate control node
Definition at line 68 of file dominatorTreesAndDominanceFrontiers/ControlFlowGraph.h.
References _backIndex, _forIndex, and FORWARD.
void DominatorTreesAndDominanceFrontiers::ControlFlowGraph::outputCFGImpl | ( | ) |
dump the contents of the original CFGImpl to a dot file
|
private |
|
private |
|
private |
|
private |
|
privatevirtual |
This virtual function can be overriden to control how data is presented by printGraph(). It defaults to simply outputting the data onto os.
Reimplemented from SimpleDirectedGraph.
void DominatorTreesAndDominanceFrontiers::ControlFlowGraph::createNode | ( | CFGNodeImpl * | node) |
from a given CFGImpl node, create one (or more) ControlNodes
|
inline |
return the number of nodes in the CFG
Definition at line 65 of file staticInterproceduralSlicing/ControlFlowGraph.h.
References _numNodes.
|
inline |
given a node id (and which numbering scheme to use), return the appropriate control node
Definition at line 68 of file staticInterproceduralSlicing/ControlFlowGraph.h.
References _backIndex, _forIndex, and FORWARD.
void DominatorTreesAndDominanceFrontiers::ControlFlowGraph::outputCFGImpl | ( | ) |
dump the contents of the original CFGImpl to a dot file
|
private |
|
private |
|
private |
|
private |
|
privatevirtual |
This virtual function can be overriden to control how data is presented by printGraph(). It defaults to simply outputting the data onto os.
Reimplemented from SimpleDirectedGraph.
|
private |
Definition at line 83 of file dominatorTreesAndDominanceFrontiers/ControlFlowGraph.h.
|
private |
Definition at line 85 of file dominatorTreesAndDominanceFrontiers/ControlFlowGraph.h.
Referenced by getSize().
|
private |
Definition at line 86 of file dominatorTreesAndDominanceFrontiers/ControlFlowGraph.h.
|
private |
Definition at line 87 of file dominatorTreesAndDominanceFrontiers/ControlFlowGraph.h.
|
private |
Map from CFGImpl nodes to our ControlNodes (used for empty CFGNodeImpls)
Definition at line 90 of file dominatorTreesAndDominanceFrontiers/ControlFlowGraph.h.
|
private |
Map from SgNodes to ControlNodes (used for ControlNodes with statements)
Definition at line 92 of file dominatorTreesAndDominanceFrontiers/ControlFlowGraph.h.
|
private |
Array matches IDs to ControlNodes using forward ids.
Definition at line 95 of file dominatorTreesAndDominanceFrontiers/ControlFlowGraph.h.
Referenced by getNode().
|
private |
Array matches IDs to ControlNodes using backward ids.
Definition at line 97 of file dominatorTreesAndDominanceFrontiers/ControlFlowGraph.h.
Referenced by getNode().