hash_set<const Function*> GraphDone;
DSGraph *GlobalsGraph;
public:
- ~TDDataStructures() { releaseMemory(); }
+ ~TDDataStructures() { releaseMyMemory(); }
virtual bool run(Module &M);
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);
hash_set<const Function*> GraphDone;
DSGraph *GlobalsGraph;
public:
- ~TDDataStructures() { releaseMemory(); }
+ ~TDDataStructures() { releaseMyMemory(); }
virtual bool run(Module &M);
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);
#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.
// 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;
calculateGraph(*I->first);
}
}
+