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

Brian Gaeke gaeke at cs.uiuc.edu
Fri Jun 11 15:55:02 PDT 2004


Changes in directory reopt/lib/LightWtProfiling:

UnpackTraceFunction.cpp updated: 1.82 -> 1.83

---
Log message:

Just some improvements to debugging info.


---
Diffs of the changes:  (+27 -6)

Index: reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp
diff -u reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.82 reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.83
--- reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.82	Wed Jun  9 15:26:15 2004
+++ reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp	Fri Jun 11 15:54:18 2004
@@ -144,6 +144,27 @@
   return std::string("reg#")  + utostr(R) + "(" + RegTypeStrings[RegType] + ")=%" + RegName;
 }
 
+void UnpackTraceFunction::PrintAI (const AllocInfo &AI) const {
+  switch (AI.AllocState) {
+    case AllocInfo::Allocated:
+      std::cerr << "allocated to " << RegStr (AI.Placement); return;
+    case AllocInfo::Spilled:
+      std::cerr << "spilled at 0x" << std::hex << AI.Placement << std::dec; return;
+    case AllocInfo::NotAllocated:
+      std::cerr << "not allocated"; return;
+  }
+}
+
+void UnpackTraceFunction::PrintValueAIs (const std::string &ValueName,
+                                         const AllocInfo &MatrixAI,
+                                         const AllocInfo &TraceAI) const {
+  std::cerr << ValueName << " is ";
+  PrintAI (MatrixAI);
+  std::cerr << " in MatrixFn and ";
+  PrintAI (TraceAI);
+  std::cerr << " in TraceFn\n";
+}
+
 void UnpackTraceFunction::rewriteProlog (MachineFunction &MF,
                                          MachineBasicBlock &EntryBB) {
   const SparcV9RegInfo &TRI = *TM->getRegInfo ();
@@ -195,6 +216,8 @@
             && (Source.AllocState == AllocInfo::Allocated
                 || Source.AllocState == AllocInfo::Spilled)
             && "Can only handle live-in values in registers or stack slots");
+    DEBUG (std::cerr << "rewriteProlog: copying live-in value: ";
+           PrintValueAIs(V->getName(), Source, Target));
     if (Target.AllocState == AllocInfo::Allocated)
       R = Target.Placement;
     else if (Target.AllocState == AllocInfo::Spilled)
@@ -281,6 +304,8 @@
     assert (Target.AllocState == AllocInfo::Allocated
             && "Live-out values must be in regs in the matrixFn");
     mvec.clear ();
+    DEBUG (std::cerr << "rewriteEpilog: copying live-out value: ";
+           PrintValueAIs(V->getName(), Target, Source));
     if (Source.AllocState == AllocInfo::NotAllocated) {
       assert (isa<Constant> (TF->getCorrespondingValue (V, false))
               && "Can't handle non-constant, non-allocated live-out value in traceFn");
@@ -288,9 +313,8 @@
                               g1, mvec);
       unsigned R = g1;
       unsigned RegType = TRI.getRegType (R);
-      DEBUG (std::cerr << "rewriteEpilog: saving live-out value: " << V->getName()
-             << " is allocated to " << RegStr (Target.Placement)
-             << " in MatrixFn and is a constant in TraceFn\n");
+      DEBUG (std::cerr << "rewriteEpilog: " << V->getName()
+             << " is a constant in TraceFn\n");
       TRI.cpReg2MemMI (mvec, R, sp, stackOffsetForReg (Target.Placement),
                        RegType, g2);
     } else {
@@ -298,9 +322,6 @@
               && "Can't handle live-out value spilled in traceFn");
       unsigned R = Source.Placement;
       unsigned RegType = TRI.getRegType (R);
-      DEBUG (std::cerr << "rewriteEpilog: saving live-out value: " << V->getName()
-             << " is allocated to " << RegStr (Target.Placement)
-             << " in MatrixFn and " << RegStr (Source.Placement) << " in TraceFn\n");
       TRI.cpReg2MemMI (mvec, R, sp, stackOffsetForReg (Target.Placement),
                        RegType, g2);
     }





More information about the llvm-commits mailing list