[llvm-commits] CVS: reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp

Brian Gaeke gaeke at cs.uiuc.edu
Thu Mar 11 03:34:01 PST 2004


Changes in directory reopt/lib/LightWtProfiling:

UnpackTraceFunction.cpp updated: 1.43 -> 1.44

---
Log message:

Add more debugging info and assertions.


---
Diffs of the changes:  (+8 -0)

Index: reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp
diff -u reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.43 reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.44
--- reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.43	Wed Mar 10 13:03:45 2004
+++ reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp	Thu Mar 11 03:33:04 2004
@@ -200,6 +200,8 @@
 static AllocInfo getValueAllocStateFromModule (Function *F, Value *V) {
   unsigned FI = getLLVMFunctionPositionInfo (F);
   FunctionAllocState *FAllocState = _llvm_regAllocState.functions[FI];
+  assert (FAllocState->numTuples > 0
+          && "Reg. alloc state for function is empty");
   int InstructionKey = -1, OperandKey = -1;
   if (Argument *A = dyn_cast<Argument> (V)) {
     // Find the alloc state of an argument.
@@ -236,6 +238,7 @@
   unsigned FI = getLLVMFunctionPositionInfo (F);
   // Get the saved PhyRegAlloc state for F out of ExportedFnAllocState:
   std::vector<AllocInfo> &FState = ExportedFnAllocState[F];
+  assert (FState.size () > 0 && "Reg. alloc state for function is empty");
   int InstructionKey = -1, OperandKey = -1;
   if (Argument *A = dyn_cast<Argument> (V)) {
     // Find the alloc state of an argument.
@@ -252,8 +255,13 @@
   }
   // Reconstruct the AllocInfo for V by searching
   // FState for a tuple that starts with (InstructionKey, OperandKey, ...):
+  DEBUG(std::cerr << "Looking for " << F->getName () << "()'s value "
+                  << *V << "(Instruction " << InstructionKey << " Operand "
+                  << OperandKey << ")... " << FState.size ()
+                  << " tuples to search.\n");
   for (unsigned i = 0, s = FState.size (); i < s; ++i) {
     AllocInfo &T = FState[i];
+    DEBUG(std::cerr << "Considering: " << T << "\n");
     if (T.Instruction == InstructionKey && T.Operand == OperandKey)
       return T;
   }





More information about the llvm-commits mailing list