[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Feb 1 09:36:07 PST 2005



Changes in directory llvm/lib/Analysis/DataStructure:

BottomUpClosure.cpp updated: 1.87 -> 1.88
---
Log message:

Do not revisit nodes in the SCC traversal.  This speeds up the BU pass a bit.


---
Diffs of the changes:  (+29 -7)

 BottomUpClosure.cpp |   36 +++++++++++++++++++++++++++++-------
 1 files changed, 29 insertions(+), 7 deletions(-)


Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp
diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.87 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.88
--- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.87	Sun Jan 30 18:10:45 2005
+++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp	Tue Feb  1 11:35:52 2005
@@ -40,9 +40,13 @@
   GlobalsGraph = new DSGraph(LocalDSA.getGlobalsGraph());
   GlobalsGraph->setPrintAuxCalls();
 
+  std::vector<Function*> Stack;
+  hash_map<Function*, unsigned> ValMap;
+  unsigned NextID = 1;
+
   Function *MainFunc = M.getMainFunction();
   if (MainFunc)
-    calculateReachableGraphs(MainFunc);
+    calculateGraphs(MainFunc, Stack, NextID, ValMap);
 
   // Calculate the graphs for any functions that are unreachable from main...
   for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
@@ -52,7 +56,7 @@
         std::cerr << "*** Function unreachable from main: "
                   << I->getName() << "\n";
 #endif
-      calculateReachableGraphs(I);    // Calculate all graphs...
+      calculateGraphs(I, Stack, NextID, ValMap);     // Calculate all graphs.
     }
 
   NumCallEdges += ActualCallees.size();
@@ -69,10 +73,6 @@
 }
 
 void BUDataStructures::calculateReachableGraphs(Function *F) {
-  std::vector<Function*> Stack;
-  hash_map<Function*, unsigned> ValMap;
-  unsigned NextID = 1;
-  calculateGraphs(F, Stack, NextID, ValMap);
 }
 
 DSGraph &BUDataStructures::getOrCreateGraph(Function *F) {
@@ -253,7 +253,29 @@
 
   DSGraph::ReturnNodesTy &ReturnNodes = Graph.getReturnNodes();
 
-  // Loop over all of the resolvable call sites
+  // Print out multi-call sites.
+  bool Printed = false;
+  for (std::list<DSCallSite>::iterator I = TempFCs.begin(), E = TempFCs.end();
+       I != E; ++I) {
+    if (!I->isDirectCall()) {
+      DSNode *Node = I->getCalleeNode();
+      if (Node->getGlobals().size() > 1) {
+        if (!Printed)
+          std::cerr << "In Fns: " << Graph.getFunctionNames() << "\n";
+        std::cerr << "  calls " << Node->getGlobals().size()
+                  << " fns from site: " << *I->getCallSite().getInstruction();
+        unsigned NumToPrint = Node->getGlobals().size();
+        if (NumToPrint > 5) NumToPrint = 5;
+        std::cerr << "   Fns =";
+        for (unsigned i = 0; i != NumToPrint; ++i) 
+          std::cerr << " " << Node->getGlobals()[i]->getName();
+        std::cerr << "\n";
+      }
+    }
+  }
+
+
+  // Loop over all of the resolvable call sites.
   DSCallSiteIterator I = DSCallSiteIterator::begin(TempFCs);
   DSCallSiteIterator E = DSCallSiteIterator::end(TempFCs);
 






More information about the llvm-commits mailing list