00001 00016 #ifndef DGraphIterativeDFP_h 00017 #define DGraphIterativeDFP_h 00018 00019 //#ifndef DirectedGraph_h 00020 //#include <libs/support/graphs/directedGraph/DirectedGraph.h> 00021 //#endif 00022 // Going to attempt to use DGraph instead 00023 #include <OpenAnalysis/Utils/OA_ptr.hpp> 00024 #include <OpenAnalysis/Utils/DGraph/DGraphInterface.hpp> 00025 #include <OpenAnalysis/CFG/CFGInterface.hpp> 00026 #include <OpenAnalysis/CFG/CFG.hpp> 00027 00028 #include <iostream> 00029 00030 namespace OA { 00031 namespace DataFlow { 00032 00033 //********************************************************************* 00034 // class DGraphIterativeDFP 00035 //********************************************************************* 00036 class DGraphIterativeDFP { 00037 public: 00038 //-------------------------------------------------------- 00039 // constructor/destructor 00040 //-------------------------------------------------------- 00041 DGraphIterativeDFP(); 00042 virtual ~DGraphIterativeDFP(); 00043 00044 //-------------------------------------------------------- 00045 // Kildall iterative solver 00046 //-------------------------------------------------------- 00047 void solve(OA_ptr<DGraph::DGraphInterface> dg, 00048 DGraph::DGraphEdgeDirection alongFlow); 00049 00050 int afterSolve_getNumIter() {return numIter;} 00051 00052 private: 00053 00054 int numIter; 00055 00056 //-------------------------------------------------------- 00057 // initialization callback 00058 //-------------------------------------------------------- 00059 virtual void initialize(OA_ptr<DGraph::DGraphInterface> dg) = 0; 00060 00061 //-------------------------------------------------------- 00062 // solver callbacks 00063 //-------------------------------------------------------- 00064 // atDGraphNode and atDGraphEdge return true if change 00065 // in dataflow information at the graph element 00066 virtual bool atDGraphNode(OA_ptr<DGraph::NodeInterface>, 00067 DGraph::DGraphEdgeDirection); 00068 virtual bool atDGraphEdge(OA_ptr<DGraph::EdgeInterface>, 00069 DGraph::DGraphEdgeDirection); 00070 00071 //-------------------------------------------------------- 00072 // finalization callbacks 00073 //-------------------------------------------------------- 00074 virtual void finalizeNode(OA_ptr<DGraph::NodeInterface> node); 00075 virtual void finalizeEdge(OA_ptr<DGraph::EdgeInterface> edge); 00076 }; 00077 00078 } // end of DataFlow 00079 } // end of OA namespace 00080 00081 #endif
1.7.1