[llvm-commits] [poolalloc] r130267 - /poolalloc/trunk/lib/DSA/StdLibPass.cpp

Arushi Aggarwal aggarwa4 at illinois.edu
Tue Apr 26 17:37:00 PDT 2011


Author: aggarwa4
Date: Tue Apr 26 19:37:00 2011
New Revision: 130267

URL: http://llvm.org/viewvc/llvm-project?rev=130267&view=rev
Log:
Allow an option to turn off the Stdlib processing of
graphs. This might help identify all external nodes, if
ever needed. Also, might be useful for statistic 
measurements.

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

Modified: poolalloc/trunk/lib/DSA/StdLibPass.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/StdLibPass.cpp?rev=130267&r1=130266&r2=130267&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/StdLibPass.cpp (original)
+++ poolalloc/trunk/lib/DSA/StdLibPass.cpp Tue Apr 26 19:37:00 2011
@@ -31,6 +31,7 @@
 
 static RegisterPass<StdLibDataStructures>
 X("dsa-stdlib", "Standard Library Local Data Structure Analysis");
+
 STATISTIC(NumNodesFoldedInStdLib,    "Number of nodes folded in std lib");
 
 char StdLibDataStructures::ID;
@@ -41,6 +42,10 @@
          cl::desc("Don't fold nodes in std-lib."),
          cl::Hidden,
          cl::init(false));
+  static cl::opt<bool> DisableStdLib("disable-dsa-stdlib",
+         cl::desc("Don't use DSA's stdlib pass."),
+         cl::Hidden,
+         cl::init(false));
 }
 
 //
@@ -442,48 +447,51 @@
         eraseCallsTo(I);
     }
 
-  //
-  // Scan through the function summaries and process functions by summary.
-  //
-  for (int x = 0; recFuncs[x].name; ++x) 
-    if (Function* F = M.getFunction(recFuncs[x].name))
-      if (F->isDeclaration()) {
-        processFunction(x, F);
-      }
+  if(!DisableStdLib) {
 
-  std::set<std::string>::iterator ai = AllocWrappersAnalysis->alloc_begin();
-  std::set<std::string>::iterator ae = AllocWrappersAnalysis->alloc_end();
-  int x;
-  for (x = 0; recFuncs[x].name; ++x) {
-    if(recFuncs[x].name == std::string("malloc"))
-      break;
-  }
+    //
+    // Scan through the function summaries and process functions by summary.
+    //
+    for (int x = 0; recFuncs[x].name; ++x) 
+      if (Function* F = M.getFunction(recFuncs[x].name))
+        if (F->isDeclaration()) {
+          processFunction(x, F);
+        }
 
-  for(;ai != ae; ++ai) {
-    if(Function* F = M.getFunction(*ai))
-    processFunction(x, F);
-  }
+    std::set<std::string>::iterator ai = AllocWrappersAnalysis->alloc_begin();
+    std::set<std::string>::iterator ae = AllocWrappersAnalysis->alloc_end();
+    int x;
+    for (x = 0; recFuncs[x].name; ++x) {
+      if(recFuncs[x].name == std::string("malloc"))
+        break;
+    }
 
-  ai = AllocWrappersAnalysis->dealloc_begin();
-  ae = AllocWrappersAnalysis->dealloc_end();
-  for (x = 0; recFuncs[x].name; ++x) {
-    if(recFuncs[x].name == std::string("free"))
-      break;
-  }
+    for(;ai != ae; ++ai) {
+      if(Function* F = M.getFunction(*ai))
+        processFunction(x, F);
+    }
 
-  for(;ai != ae; ++ai) {
-    if(Function* F = M.getFunction(*ai))
-    processFunction(x, F);
-  }
+    ai = AllocWrappersAnalysis->dealloc_begin();
+    ae = AllocWrappersAnalysis->dealloc_end();
+    for (x = 0; recFuncs[x].name; ++x) {
+      if(recFuncs[x].name == std::string("free"))
+        break;
+    }
 
-  //
-  // Merge return values and checked pointer values for SAFECode run-time
-  // checks.
-  //
-  processRuntimeCheck (M, "sc.boundscheck", 3);
-  processRuntimeCheck (M, "sc.boundscheckui", 3);
-  processRuntimeCheck (M, "sc.exactcheck2", 2);
-  processRuntimeCheck (M, "sc.get_actual_val", 2);
+    for(;ai != ae; ++ai) {
+      if(Function* F = M.getFunction(*ai))
+        processFunction(x, F);
+    }
+
+    //
+    // Merge return values and checked pointer values for SAFECode run-time
+    // checks.
+    //
+    processRuntimeCheck (M, "sc.boundscheck", 3);
+    processRuntimeCheck (M, "sc.boundscheckui", 3);
+    processRuntimeCheck (M, "sc.exactcheck2", 2);
+    processRuntimeCheck (M, "sc.get_actual_val", 2);
+  }
 
   //
   // In the Local DSA Pass, we marked nodes passed to/returned from 'StdLib'





More information about the llvm-commits mailing list