[llvm-commits] [poolalloc] r128816 - /poolalloc/trunk/lib/DSA/DSTest.cpp

Arushi Aggarwal aggarwa4 at illinois.edu
Mon Apr 4 07:32:53 PDT 2011


Author: aggarwa4
Date: Mon Apr  4 09:32:53 2011
New Revision: 128816

URL: http://llvm.org/viewvc/llvm-project?rev=128816&view=rev
Log:
Keep a reference to the module, instead of going 
through the function pointer. This is needed for
globals.

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

Modified: poolalloc/trunk/lib/DSA/DSTest.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DSTest.cpp?rev=128816&r1=128815&r2=128816&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DSTest.cpp (original)
+++ poolalloc/trunk/lib/DSA/DSTest.cpp Mon Apr  4 09:32:53 2011
@@ -80,6 +80,7 @@
 class NodeValue {
   // Containing Function, if applicable.
   Function *F;
+  Module *ParentM;
   // Value in that graph's scalarmap that we base off of
   // (note that the NH we have below could be indexed a few times
   // from this value, only corresponds directly if no offsets)
@@ -188,6 +189,7 @@
 
       // First, find the function
       F = M->getFunction(func);
+      ParentM = const_cast<Module*>(M);
       assert(F && "Unable to find function specified!");
 
       // Now we try to find the value...
@@ -229,6 +231,7 @@
   // are a bit confusing in the context of offsets.  Make this not lame.
   Value    * getValue()     { return V;                           }
   Function * getFunction()  { return F;                           }
+  Module * getParentModule()  { return ParentM;                           }
 
   /// Helper to fetch the node from the nodehandle
   DSNode * getNode() {
@@ -273,7 +276,7 @@
 // (meant to be called as a helper)
 static void printTypesForNode(llvm::raw_ostream &O, NodeValue &NV) {
   DSNode *N = NV.getNode();
-  Module *M = NV.getFunction()->getParent();
+  Module *M = NV.getParentModule();
 
   if (N->isNodeCompletelyFolded()) {
     O << "Folded";





More information about the llvm-commits mailing list