aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis/DataStructure/TopDownClosure.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Analysis/DataStructure/TopDownClosure.cpp')
-rw-r--r--lib/Analysis/DataStructure/TopDownClosure.cpp32
1 files changed, 19 insertions, 13 deletions
diff --git a/lib/Analysis/DataStructure/TopDownClosure.cpp b/lib/Analysis/DataStructure/TopDownClosure.cpp
index b4b43f7..1da43e5 100644
--- a/lib/Analysis/DataStructure/TopDownClosure.cpp
+++ b/lib/Analysis/DataStructure/TopDownClosure.cpp
@@ -16,24 +16,12 @@
static RegisterAnalysis<TDDataStructures>
Y("tddatastructure", "Top-down Data Structure Analysis Closure");
-// releaseMemory - If the pass pipeline is done with this pass, we can release
-// our memory... here...
-//
-void TDDataStructures::releaseMemory() {
- for (std::map<const Function*, DSGraph*>::iterator I = DSInfo.begin(),
- E = DSInfo.end(); I != E; ++I)
- delete I->second;
-
- // Empty map so next time memory is released, data structures are not
- // re-deleted.
- DSInfo.clear();
-}
-
// run - Calculate the top down data structure graphs for each function in the
// program.
//
bool TDDataStructures::run(Module &M) {
BUDataStructures &BU = getAnalysis<BUDataStructures>();
+ GlobalsGraph = new DSGraph();
// Calculate top-down from main...
if (Function *F = M.getMainFunction())
@@ -43,9 +31,26 @@ bool TDDataStructures::run(Module &M) {
for (Module::reverse_iterator I = M.rbegin(), E = M.rend(); I != E; ++I)
if (!I->isExternal())
calculateGraph(*I);
+
+ GraphDone.clear(); // Free temporary memory...
return false;
}
+// releaseMemory - If the pass pipeline is done with this pass, we can release
+// our memory... here...
+//
+void TDDataStructures::releaseMemory() {
+ for (std::map<const Function*, DSGraph*>::iterator I = DSInfo.begin(),
+ E = DSInfo.end(); I != E; ++I)
+ delete I->second;
+
+ // Empty map so next time memory is released, data structures are not
+ // re-deleted.
+ DSInfo.clear();
+ delete GlobalsGraph;
+ GlobalsGraph = 0;
+}
+
/// ResolveCallSite - This method is used to link the actual arguments together
/// with the formal arguments for a function call in the top-down closure. This
/// method assumes that the call site arguments have been mapped into nodes
@@ -77,6 +82,7 @@ DSGraph &TDDataStructures::getOrCreateDSGraph(Function &F) {
if (G == 0) { // Not created yet? Clone BU graph...
G = new DSGraph(getAnalysis<BUDataStructures>().getDSGraph(F));
G->getAuxFunctionCalls().clear();
+ G->setGlobalsGraph(GlobalsGraph);
}
return *G;
}