[llvm-commits] [see] CVS: llvm-poolalloc/lib/DSA/Local.cpp

Andrew Lenharth alenhar2 at cs.uiuc.edu
Thu Jun 28 10:40:23 PDT 2007



Changes in directory llvm-poolalloc/lib/DSA:

Local.cpp updated: 1.158.2.4.2.11 -> 1.158.2.4.2.12
---
Log message:

add hacky debug support for unknowns, and add 1 and -1 as null values (as used too often in the linux kernel)

---
Diffs of the changes:  (+32 -4)

 Local.cpp |   36 ++++++++++++++++++++++++++++++++----
 1 files changed, 32 insertions(+), 4 deletions(-)


Index: llvm-poolalloc/lib/DSA/Local.cpp
diff -u llvm-poolalloc/lib/DSA/Local.cpp:1.158.2.4.2.11 llvm-poolalloc/lib/DSA/Local.cpp:1.158.2.4.2.12
--- llvm-poolalloc/lib/DSA/Local.cpp:1.158.2.4.2.11	Fri May 18 13:26:25 2007
+++ llvm-poolalloc/lib/DSA/Local.cpp	Thu Jun 28 12:39:40 2007
@@ -42,6 +42,23 @@
 static Statistic<> GlobalPools ("dsa", "Number of global pools");
 #endif
 
+Statistic<> stat_unknown ("dsa", "Number of markunknowns");
+static cl::opt<bool>
+Crash("dsa-crash", cl::Hidden,
+         cl::desc("Crash on unknowns"));
+static cl::opt<int>
+CrashAt("dsa-crashat", cl::Hidden,
+         cl::desc("Crash on unknowns"));
+static int CrashCur = 0;
+DSNode *DSNode::setUnknownNodeMarker() { 
+  if (Crash && CrashCur == CrashAt) assert(0); 
+  ++CrashCur;
+  ++stat_unknown; 
+  NodeType |= UnknownNode; 
+  return this;
+}
+
+
 static RegisterPass<LocalDataStructures>
 X("datastructure", "Local Data Structure Analysis");
 
@@ -116,7 +133,7 @@
       Value::use_iterator U;
       for (U=f.use_begin(); U != f.use_end(); ++U) {
         if (isa<GlobalValue>(U)) {
-          std::cerr << "LLVA: isa: " << f.getName() << " " << *U << std::endl;
+          //          std::cerr << "LLVA: isa: " << f.getName() << " " << *U << std::endl;
           escapes = true;
           break;
         }
@@ -283,7 +300,15 @@
         if (isa<PointerType>(CE->getOperand(0)->getType()))
           NH = getValueDest(*CE->getOperand(0));
         else
-          NH = createNode()->setUnknownNodeMarker();
+          if (CE->getOpcode() == Instruction::Cast &&
+              isa<ConstantInt>(CE->getOperand(0)) && 
+              (
+               cast<ConstantInt>(CE->getOperand(0))->equalsInt(1) ||
+               cast<ConstantInt>(CE->getOperand(0))->getZExtValue() == 0xFFFFFFFF
+               ))
+            NH = createNode();
+          else
+            NH = createNode()->setUnknownNodeMarker();
       } else if (CE->getOpcode() == Instruction::GetElementPtr) {
         visitGetElementPtrInst(*CE);
         DSScalarMap::iterator I = ScalarMap.find(CE);
@@ -1114,7 +1139,7 @@
       DSNode *N = createNode();
       N->setAllocaNodeMarker();
       N->setUnknownNodeMarker();
-      N->setIncompleteMarker();
+      CS.getInstruction()->dump();
       N->foldNodeCompletely();
 
       //
@@ -1239,6 +1264,7 @@
       // to track the fact that the node points to SOMETHING, just something we
       // don't know about.  Make an "Unknown" node.
       //
+      CI.dump();
       setDestTo(CI, createNode()->setUnknownNodeMarker());
     }
 }
@@ -1255,8 +1281,10 @@
     if (isPointerType((*I)->getType()))
       CurNode.mergeWith(getValueDest(**I));
 
-  if (DSNode *N = CurNode.getNode())
+  if (DSNode *N = CurNode.getNode()) {
+    Inst.dump();
     N->setUnknownNodeMarker();
+  }
 }
 
 






More information about the llvm-commits mailing list