[llvm-commits] [poolalloc] r116810 - /poolalloc/trunk/lib/DSA/BottomUpClosure.cpp

Arushi Aggarwal aggarwa4 at illinois.edu
Tue Oct 19 09:03:34 PDT 2010


Author: aggarwa4
Date: Tue Oct 19 11:03:33 2010
New Revision: 116810

URL: http://llvm.org/viewvc/llvm-project?rev=116810&view=rev
Log:
Changes to allow for a more complete call graph.

Merge information back from globals graph into the 
individual function's graph, so that more exact call
graph can be constructed, for calls, made through 
global objects/structs.


Modified:
    poolalloc/trunk/lib/DSA/BottomUpClosure.cpp

Modified: poolalloc/trunk/lib/DSA/BottomUpClosure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/BottomUpClosure.cpp?rev=116810&r1=116809&r2=116810&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/BottomUpClosure.cpp (original)
+++ poolalloc/trunk/lib/DSA/BottomUpClosure.cpp Tue Oct 19 11:03:33 2010
@@ -141,16 +141,18 @@
   formGlobalECs();
 
   // Merge the globals variables (not the calls) from the globals graph back
-  // into the main function's graph so that the main function contains all of
-  // the information about global pools and GV usage in the program.
-  for (std::vector<const Function*>::iterator ii = EntryPoints.begin(),
-       ee = EntryPoints.end(); ii != ee; ++ii) {
-    DSGraph* MainGraph = getOrCreateGraph(*ii);
-    cloneGlobalsInto(MainGraph);
-
-    MainGraph->maskIncompleteMarkers();
-    MainGraph->markIncompleteNodes(DSGraph::MarkFormalArgs |
+  // into the individual function's graph so that changes made to globals during
+  // BU can be reflected. This is specifically needed for correct call graph 
+  
+  for (Module::iterator F = M.begin(); F != M.end(); ++F) {
+    if (!(F->isDeclaration())){
+      DSGraph *Graph  = getOrCreateGraph(F);
+      cloneGlobalsInto(Graph);
+      Graph->maskIncompleteMarkers();
+      Graph->markIncompleteNodes(DSGraph::MarkFormalArgs |
                                    DSGraph::IgnoreGlobals);
+      
+    }
   }
 
   NumCallEdges += callgraph.size();
@@ -161,7 +163,7 @@
   //
   callgraph.buildSCCs();
   callgraph.buildRoots();
-
+  
   return false;
 }
 
@@ -509,6 +511,7 @@
   return MyID;  // == Min
 }
 
+#if 0
 //
 // Method: postOrder()
 //
@@ -608,6 +611,7 @@
   GlobalsGraph->getScalarMap().clear_scalars();
 }
 
+#endif
 
 //
 // Method: CloneAuxIntoGlobal()
@@ -686,7 +690,7 @@
 
     // Fast path for noop calls.  Note that we don't care about merging globals
     // in the callee with nodes in the caller here.
-    if (CS.getRetVal().isNull() && CS.getNumPtrArgs() == 0 && !CS.isVarArg()) {
+    if (!CS.isIndirectCall() && CS.getRetVal().isNull() && CS.getNumPtrArgs() == 0 && !CS.isVarArg()) {
       TempFCs.erase(TempFCs.begin());
       continue;
     }
@@ -742,7 +746,7 @@
         std::sort(NodeCallees.begin(), NodeCallees.end());
         eraseCS = std::includes(CalledFuncs.begin(), CalledFuncs.end(),
                                 NodeCallees.begin(), NodeCallees.end());
-      }
+      } 
 
       //
       // Update the statistics on resolved indirect function calls.





More information about the llvm-commits mailing list