00001 00015 #ifndef ICFGDep_hpp 00016 #define ICFGDep_hpp 00017 00018 #include <set> 00019 #include <map> 00020 #include <OpenAnalysis/Utils/OA_ptr.hpp> 00021 #include <OpenAnalysis/IRInterface/IRHandles.hpp> 00022 #include <OpenAnalysis/Location/Locations.hpp> 00023 00024 #include "DepDFSet.hpp" 00025 00026 00027 namespace OA { 00028 namespace Activity { 00029 00030 /* 00031 Maps each statement to a set of Dependences use,def where use is a 00032 differentiable location used at some point when defining the def location. 00033 Also keeps track of must def locations for a statement. 00034 Doesn't have use,def pairs for procedure calls. In statements with 00035 procedure calls, just has other uses and defs. 00036 00037 For example, 00038 a = foo(x, &y) 00039 has the Dep <x,a> but not <y,a> or <x,y>. 00040 */ 00041 class ICFGDep : public virtual Annotation { 00042 public: 00043 ICFGDep() {} 00044 ~ICFGDep() {} 00045 00046 //***************************************************************** 00047 // Interface Implementation 00048 //***************************************************************** 00049 00052 OA_ptr<LocIterator> 00053 getMayDefIterator(StmtHandle stmt, const OA_ptr<Location> use); 00054 00058 OA_ptr<LocIterator> 00059 getDiffUseIterator(StmtHandle stmt, OA_ptr<Location> def); 00060 00063 OA_ptr<LocIterator> getMustDefIterator(StmtHandle stmt); 00064 00065 //***************************************************************** 00066 // Construction methods 00067 //***************************************************************** 00068 00070 void mapStmtToDeps(StmtHandle stmt, OA_ptr<DepDFSet> depDFSet) 00071 { mDepDFSet[stmt] = depDFSet; } 00072 00074 void insertDepForStmt(StmtHandle stmt, OA_ptr<Location> use, 00075 OA_ptr<Location> def); 00076 00078 void insertMustDefForStmt(StmtHandle stmt, OA_ptr<Location> def); 00079 00080 //***************************************************************** 00081 // Annotation Interface 00082 //***************************************************************** 00083 void output(OA::IRHandlesIRInterface& ir); 00084 00085 //***************************************************************** 00086 // Output 00087 //***************************************************************** 00088 void dump(std::ostream& os, OA_ptr<IRHandlesIRInterface> ir); 00089 00090 private: 00091 std::map<StmtHandle,OA_ptr<DepDFSet> > mDepDFSet; 00092 00093 std::map<StmtHandle,OA_ptr<LocSet> > mMustDefMap; 00094 00095 }; 00096 00097 00098 } // end of Activity namespace 00099 } // end of OA namespace 00100 00101 #endif 00102
1.6.1