diff options
| author | Chris Lattner <sabre@nondot.org> | 2003-02-03 22:51:28 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2003-02-03 22:51:28 +0000 |
| commit | 390cec0c77798979ced35c55ad6a57b233794091 (patch) | |
| tree | 34c23f02e1534899eff2aa404621c57667962978 | |
| parent | 8fd2b775472846b22b7ed31825afc94894780f27 (diff) | |
| download | bcm5719-llvm-390cec0c77798979ced35c55ad6a57b233794091.tar.gz bcm5719-llvm-390cec0c77798979ced35c55ad6a57b233794091.zip | |
Hack to work around deficiency in pass infrastructure
llvm-svn: 5485
| -rw-r--r-- | llvm/include/llvm/Analysis/DataStructure.h | 5 | ||||
| -rw-r--r-- | llvm/lib/Analysis/DataStructure/TopDownClosure.cpp | 12 |
2 files changed, 12 insertions, 5 deletions
diff --git a/llvm/include/llvm/Analysis/DataStructure.h b/llvm/include/llvm/Analysis/DataStructure.h index ddaf83a4592..ebcc3c5c645 100644 --- a/llvm/include/llvm/Analysis/DataStructure.h +++ b/llvm/include/llvm/Analysis/DataStructure.h @@ -136,7 +136,7 @@ class TDDataStructures : public Pass { hash_set<const Function*> GraphDone; DSGraph *GlobalsGraph; public: - ~TDDataStructures() { releaseMemory(); } + ~TDDataStructures() { releaseMyMemory(); } virtual bool run(Module &M); @@ -157,13 +157,14 @@ public: void print(std::ostream &O, const Module *M) const; // If the pass pipeline is done with this pass, we can release our memory... - virtual void releaseMemory(); + virtual void releaseMyMemory(); // getAnalysisUsage - This obviously provides a data structure graph. virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); AU.addRequired<BUDataStructures>(); } + private: void calculateGraph(Function &F); DSGraph &getOrCreateDSGraph(Function &F); diff --git a/llvm/lib/Analysis/DataStructure/TopDownClosure.cpp b/llvm/lib/Analysis/DataStructure/TopDownClosure.cpp index 367f6a1d270..49b3a5482e8 100644 --- a/llvm/lib/Analysis/DataStructure/TopDownClosure.cpp +++ b/llvm/lib/Analysis/DataStructure/TopDownClosure.cpp @@ -13,8 +13,10 @@ #include "llvm/DerivedTypes.h" #include "Support/Statistic.h" -static RegisterAnalysis<TDDataStructures> -Y("tddatastructure", "Top-down Data Structure Analysis Closure"); +namespace { + RegisterAnalysis<TDDataStructures> // Register the pass + Y("tddatastructure", "Top-down Data Structure Analysis Closure"); +} // run - Calculate the top down data structure graphs for each function in the // program. @@ -39,7 +41,10 @@ bool TDDataStructures::run(Module &M) { // releaseMemory - If the pass pipeline is done with this pass, we can release // our memory... here... // -void TDDataStructures::releaseMemory() { +// FIXME: This should be releaseMemory and will work fine, except that LoadVN +// has no way to extend the lifetime of the pass, which screws up ds-aa. +// +void TDDataStructures::releaseMyMemory() { for (hash_map<const Function*, DSGraph*>::iterator I = DSInfo.begin(), E = DSInfo.end(); I != E; ++I) delete I->second; @@ -206,3 +211,4 @@ void TDDataStructures::calculateGraph(Function &F) { calculateGraph(*I->first); } } + |

