[llvm-commits] [poolalloc] r116629 - in /poolalloc/trunk: include/dsa/DSSupport.h include/dsa/DataStructure.h include/poolalloc/PoolAllocate.h lib/DSA/DataStructure.cpp lib/DSA/EquivClassGraphs.cpp lib/DSA/TopDownClosure.cpp lib/PoolAllocate/PoolAllocate.cpp lib/PoolAllocate/TransformFunctionBody.cpp

Arushi Aggarwal aggarwa4 at illinois.edu
Fri Oct 15 15:36:11 PDT 2010


Author: aggarwa4
Date: Fri Oct 15 17:36:11 2010
New Revision: 116629

URL: http://llvm.org/viewvc/llvm-project?rev=116629&view=rev
Log:
Instead of keeping all of CBU's data structures around so as to
be able to use the call graph.  Now restore the call graph at the
end of each subsequent pass. 

Modified:
    poolalloc/trunk/include/dsa/DSSupport.h
    poolalloc/trunk/include/dsa/DataStructure.h
    poolalloc/trunk/include/poolalloc/PoolAllocate.h
    poolalloc/trunk/lib/DSA/DataStructure.cpp
    poolalloc/trunk/lib/DSA/EquivClassGraphs.cpp
    poolalloc/trunk/lib/DSA/TopDownClosure.cpp
    poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp
    poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp

Modified: poolalloc/trunk/include/dsa/DSSupport.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/DSSupport.h?rev=116629&r1=116628&r2=116629&view=diff
==============================================================================
--- poolalloc/trunk/include/dsa/DSSupport.h (original)
+++ poolalloc/trunk/include/dsa/DSSupport.h Fri Oct 15 17:36:11 2010
@@ -98,6 +98,7 @@
   // Allow explicit conversion to DSNode...
   DSNode *getNode() const;  // Defined inline in DSNode.h
   unsigned getOffset() const {
+    getNode();
     assert(!isForwarding() && "This is a forwarding NH, call getNode() first!");
     return Offset;
   }

Modified: poolalloc/trunk/include/dsa/DataStructure.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/DataStructure.h?rev=116629&r1=116628&r2=116629&view=diff
==============================================================================
--- poolalloc/trunk/include/dsa/DataStructure.h (original)
+++ poolalloc/trunk/include/dsa/DataStructure.h Fri Oct 15 17:36:11 2010
@@ -86,6 +86,8 @@
 
   void formGlobalECs();
 
+  void restoreCorrectCallGraph();
+
   DataStructures(intptr_t id, const char* name) 
     : ModulePass(id), TD(0), GraphSource(0), printname(name), GlobalsGraph(0) {  
     // For now, the graphs are owned by this pass
@@ -315,7 +317,6 @@
   virtual void getAnalysisUsage(AnalysisUsage &AU) const {
 	AU.addRequired<EntryPointAnalysis>();
     AU.addRequired<CompleteBUDataStructures>();
-    AU.addPreserved<CompleteBUDataStructures>();
     AU.setPreservesCFG();
   }
 
@@ -369,7 +370,6 @@
   virtual void getAnalysisUsage(AnalysisUsage &AU) const {
     if (useEQBU) {
       AU.addRequired<EquivBUDataStructures>();
-      AU.addPreserved<CompleteBUDataStructures>();
     } else {
       AU.addRequired<BUDataStructures>();
       AU.addPreserved<BUDataStructures>();

Modified: poolalloc/trunk/include/poolalloc/PoolAllocate.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/poolalloc/PoolAllocate.h?rev=116629&r1=116628&r2=116629&view=diff
==============================================================================
--- poolalloc/trunk/include/poolalloc/PoolAllocate.h (original)
+++ poolalloc/trunk/include/poolalloc/PoolAllocate.h Fri Oct 15 17:36:11 2010
@@ -139,7 +139,6 @@
 class PoolAllocateGroup : public ModulePass {
 protected:
   DataStructures *Graphs;
-  DataStructures *CallGraph;
   const Type * VoidType;
   const Type * Int8Type;
   const Type * Int32Type;
@@ -274,7 +273,6 @@
   // FIXME: This method is misnamed.
   DataStructures &getGraphs() const { return *Graphs; }
 
-  DSCallGraph getCallGraph() const { return CallGraph->getCallGraph();}
   /// getOrigFunctionFromClone - Given a pointer to a function that was cloned
   /// from another function, return the original function.  If the argument
   /// function is not a clone, return null.

Modified: poolalloc/trunk/lib/DSA/DataStructure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DataStructure.cpp?rev=116629&r1=116628&r2=116629&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DataStructure.cpp (original)
+++ poolalloc/trunk/lib/DSA/DataStructure.cpp Fri Oct 15 17:36:11 2010
@@ -1402,6 +1402,14 @@
   GlobalsGraph = new DSGraph(GlobalECs, *T, *TypeSS);
 }
 
+// CBU has the correct call graph. All the passes that follow it 
+// must resotre the call graph, at the end, so that it it correct.
+// This is simpler than keeping all the CBU data structures around.
+// EQBU and subsequent passes must call this.
+void DataStructures::restoreCorrectCallGraph(){
+  callgraph = GraphSource->callgraph;
+}
+
 void DataStructures::releaseMemory() {
   //
   // If the DSGraphs were stolen by another pass, free nothing.

Modified: poolalloc/trunk/lib/DSA/EquivClassGraphs.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/EquivClassGraphs.cpp?rev=116629&r1=116628&r2=116629&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/EquivClassGraphs.cpp (original)
+++ poolalloc/trunk/lib/DSA/EquivClassGraphs.cpp Fri Oct 15 17:36:11 2010
@@ -40,13 +40,17 @@
 // in the program.
 //
 bool EquivBUDataStructures::runOnModule(Module &M) {
-  init(&getAnalysis<CompleteBUDataStructures>(), true, true, false, true);
+  init(&getAnalysis<CompleteBUDataStructures>(), false, true, false, true);
 
   //update the EQ class from indirect calls
   buildIndirectFunctionSets();
   mergeGraphsByGlobalECs();
   verifyMerging();
-  return runOnModuleInternal(M);  
+  bool result = runOnModuleInternal(M);  
+  // CBU contains the correct call graph.
+  // Restore it, so that subsequent passes and clients can get it.
+  restoreCorrectCallGraph();
+  return result;
 }
 
 void

Modified: poolalloc/trunk/lib/DSA/TopDownClosure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/TopDownClosure.cpp?rev=116629&r1=116628&r2=116629&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/TopDownClosure.cpp (original)
+++ poolalloc/trunk/lib/DSA/TopDownClosure.cpp Fri Oct 15 17:36:11 2010
@@ -151,6 +151,9 @@
   ArgsRemainIncomplete.clear();
   GlobalsGraph->removeTriviallyDeadNodes();
 
+  // CBU contains the correct call graph.
+  // Restore it, so that subsequent passes and clients can get it.
+  restoreCorrectCallGraph();
   return false;
 }
 

Modified: poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp?rev=116629&r1=116628&r2=116629&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp Fri Oct 15 17:36:11 2010
@@ -199,10 +199,6 @@
     if(lie_preserve_passes != LIE_NONE)
     	AU.addPreserved<EquivBUDataStructures>();
   }
-  AU.addRequiredTransitive<CompleteBUDataStructures>();
-  if(lie_preserve_passes != LIE_NONE)
-    AU.addPreserved<CompleteBUDataStructures>();
-  
 
   // Preserve the pool information across passes
   if (lie_preserve_passes == LIE_PRESERVE_ALL)
@@ -233,7 +229,6 @@
     Graphs = &getAnalysis<EQTDDataStructures>();    
   else
     Graphs = &getAnalysis<EquivBUDataStructures>();
-  CallGraph = &getAnalysis<CompleteBUDataStructures>();
 
   //
   // Get the heuristic pass and then tell it who we are.

Modified: poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp?rev=116629&r1=116628&r2=116629&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Fri Oct 15 17:36:11 2010
@@ -874,7 +874,7 @@
     // of pools possible and prevents us from eliding a pool because we're
     // examining a target that doesn't need it.
     //
-    const DSCallGraph & callGraph = PAInfo.getCallGraph();
+    const DSCallGraph & callGraph = Graphs.getCallGraph();
     unsigned maxArgsWithNodes = 0;
     DSCallGraph::callee_iterator I = callGraph.callee_begin(OrigInst);
     for (; I != callGraph.callee_end(OrigInst); ++I) {





More information about the llvm-commits mailing list