[llvm-commits] [poolalloc] r74940 - in /poolalloc/trunk: include/dsa/DataStructure.h lib/DSA/Steensgaard.cpp

Haohui Mai mai4 at uiuc.edu
Tue Jul 7 12:59:08 PDT 2009


Author: mai4
Date: Tue Jul  7 14:59:07 2009
New Revision: 74940

URL: http://llvm.org/viewvc/llvm-project?rev=74940&view=rev
Log:
Bug fix on handling globals graph.

Modified:
    poolalloc/trunk/include/dsa/DataStructure.h
    poolalloc/trunk/lib/DSA/Steensgaard.cpp

Modified: poolalloc/trunk/include/dsa/DataStructure.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/DataStructure.h?rev=74940&r1=74939&r2=74940&view=diff

==============================================================================
--- poolalloc/trunk/include/dsa/DataStructure.h (original)
+++ poolalloc/trunk/include/dsa/DataStructure.h Tue Jul  7 14:59:07 2009
@@ -430,6 +430,7 @@
   virtual void releaseMemory();
 
   virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+    AU.addRequired<TargetData>();
     AU.addRequired<StdLibDataStructures>();
     AU.setPreservesAll();
   }

Modified: poolalloc/trunk/lib/DSA/Steensgaard.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Steensgaard.cpp?rev=74940&r1=74939&r2=74940&view=diff

==============================================================================
--- poolalloc/trunk/lib/DSA/Steensgaard.cpp (original)
+++ poolalloc/trunk/lib/DSA/Steensgaard.cpp Tue Jul  7 14:59:07 2009
@@ -27,10 +27,10 @@
 
 void
 SteensgaardDataStructures::releaseMemory() {
-	// Here we don't need to delete the result graph, because it aliases with the
-	// GlobalsGraph, which is deleted by DataStructures::releaseMemory().
+  // Here we don't need to delete the result graph, because it aliases with the
+  // GlobalsGraph, which is deleted by DataStructures::releaseMemory().
   ResultGraph = 0;
-	DataStructures::releaseMemory();
+  DataStructures::releaseMemory();
 }
 
 // print - Implement the Pass::print method...
@@ -51,17 +51,23 @@
 bool
 SteensgaardDataStructures::runOnModule(Module &M) {
   DS = &getAnalysis<StdLibDataStructures>();
+  init(&getAnalysis<TargetData>());
   return runOnModuleInternal(M);
 }
 
 bool
 SteensgaardDataStructures::runOnModuleInternal(Module &M) {
   assert(ResultGraph == 0 && "Result graph already allocated!");
+	
 
   // Create a new, empty, graph...
   ResultGraph = new DSGraph(GlobalECs, getTargetData());
+  ResultGraph->setGlobalsGraph(ResultGraph);
   ResultGraph->spliceFrom(DS->getGlobalsGraph());
 
+  // Assign the result graph to globals graph. It should be the same.
+  GlobalsGraph = ResultGraph;
+
   // Loop over the rest of the module, merging graphs for non-external functions
   // into this graph.
   //
@@ -130,10 +136,8 @@
   // Remove any nodes that are dead after all of the merging we have done...
   // FIXME: We should be able to disable the globals graph for steens!
   
-  ResultGraph->removeDeadNodes(DSGraph::KeepUnreachableGlobals);
+  //  ResultGraph->removeDeadNodes(DSGraph::KeepUnreachableGlobals);
 
-	// Assign the result graph to globals graph. It should be the same.
-	GlobalsGraph = ResultGraph;
   print(DOUT, &M);
   return false;
 }





More information about the llvm-commits mailing list