00001 #ifndef INTERPROCEDURAL_CFG_H 00002 #define INTERPROCEDURAL_CFG_H 00003 00004 #include "staticCFG.h" 00005 #include "CallGraph.h" 00006 #include <map> 00007 #include <set> 00008 #include <string> 00009 00010 00011 class SgIncidenceDirectedGraph; 00012 class SgGraphNode; 00013 class SgDirectedGraphEdge; 00014 00015 00016 namespace StaticCFG 00017 { 00018 00019 using VirtualCFG::CFGNode; 00020 using VirtualCFG::CFGEdge; 00021 00022 00023 class InterproceduralCFG : public CFG 00024 { 00025 protected: 00026 virtual void buildCFG(CFGNode n, 00027 std::map<CFGNode, SgGraphNode*>& all_nodes, 00028 std::set<CFGNode>& explored, 00029 ClassHierarchyWrapper* classHierarchy); 00030 public: 00031 InterproceduralCFG() : CFG() {} 00032 00033 // The valid nodes are SgProject, SgStatement, SgExpression and SgInitializedName 00034 InterproceduralCFG(SgNode* node, bool is_filtered = false) 00035 : CFG() { 00036 graph_ = NULL; 00037 is_filtered_ = is_filtered; 00038 start_ = node; 00039 buildCFG(); 00040 } 00041 SgNode* getEntry() 00042 { 00043 return start_; 00044 } 00045 SgIncidenceDirectedGraph* getGraph() 00046 { 00047 return graph_; 00048 } 00049 SgGraphNode* getGraphNode(CFGNode n) { 00050 return alNodes[n]; 00051 } 00052 // Build CFG according to the 'is_filtered_' flag. 00053 virtual void buildCFG() 00054 { 00055 buildFullCFG(); 00056 } 00057 std::map<CFGNode, SgGraphNode*> alNodes; 00058 CFGNode neededStart; 00059 // Build CFG for debugging. 00060 virtual void buildFullCFG(); 00061 // Build filtered CFG which only contains interesting nodes. 00062 virtual void buildFilteredCFG(); 00063 }; 00064 00065 } // end of namespace StaticCFG 00066 00067 #endif
1.4.7