4 #include <sage3basic.h>
5 #include "AstAttributeMechanism.h"
6 #include "virtualCFG.h"
24 class ROSE_DLL_API
CFG
46 CFG() : graph_(NULL), start_(NULL), entry_(NULL), exit_(NULL) {}
58 CFG(
SgNode* node,
bool is_filtered =
false)
59 : graph_(NULL), start_(node), entry_(NULL), exit_(NULL), is_filtered_(is_filtered)
62 CFG(
SgNode* node,
bool is_filtered =
false);
70 { clearNodesAndEdges(); }
84 bool isFilteredCFG()
const {
return is_filtered_; }
85 void setFiltered(
bool flag) { is_filtered_ = flag; }
91 if (is_filtered_) buildFilteredCFG();
96 virtual void buildFullCFG();
99 virtual void buildFilteredCFG();
103 std::vector<SgDirectedGraphEdge*> getOutEdges(
SgNode* node,
int index);
104 std::vector<SgDirectedGraphEdge*> getInEdges(
SgNode* node,
int index);
108 std::vector<SgDirectedGraphEdge*> getOutEdges(
SgGraphNode* node);
109 std::vector<SgDirectedGraphEdge*> getInEdges(
SgGraphNode* node);
119 void cfgToDot(
SgNode* node,
const std::string& file_name);
123 template <
class NodeT,
class EdgeT>
124 void buildCFG(NodeT n, std::map<NodeT, SgGraphNode*>& all_nodes, std::set<NodeT>& explored);
127 void clearNodesAndEdges();
132 virtual void processNodes(std::ostream & o,
SgGraphNode* n, std::set<SgGraphNode*>& explored);
133 virtual void printNodePlusEdges(std::ostream & o,
SgGraphNode* node);
134 virtual void printNode(std::ostream & o,
SgGraphNode* node);
147 : index_(idx), graph_(graph) {}
149 int getIndex()
const {
return index_; }
151 void setIndex(
int idx) { index_ = idx; }
160 template <
class EdgeT>
167 void setEdge(
const EdgeT& e)
170 EdgeT getEdge()
const
175 std::vector<SgDirectedGraphEdge*> outEdges(
SgGraphNode* node);
176 std::vector<SgDirectedGraphEdge*> inEdges(
SgGraphNode* node);