Hack to work around deficiency in pass infrastructure
authorChris Lattner <sabre@nondot.org>
Mon, 3 Feb 2003 22:51:28 +0000 (22:51 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 3 Feb 2003 22:51:28 +0000 (22:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5485 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/DataStructure.h
include/llvm/Analysis/DataStructure/DataStructure.h
lib/Analysis/DataStructure/TopDownClosure.cpp

index ddaf83a4592f6d9eeec59fa0d29f496d153a6116..ebcc3c5c6456258a8295db22e8f6b7795ea7cfff 100644 (file)
@@ -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);
index ddaf83a4592f6d9eeec59fa0d29f496d153a6116..ebcc3c5c6456258a8295db22e8f6b7795ea7cfff 100644 (file)
@@ -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);
index 367f6a1d270874e897338a2cdefad459b7ec138a..49b3a5482e85fefea8293e946edc26fa3f49cf2b 100644 (file)
 #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);
     }
 }
+