[llvm-commits] [llvm] r146313 - /llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Fri Dec 9 18:55:06 PST 2011


Author: stoklund
Date: Fri Dec  9 20:55:06 2011
New Revision: 146313

URL: http://llvm.org/viewvc/llvm-project?rev=146313&view=rev
Log:
More debug output formatting.

Modified:
    llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp

Modified: llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp?rev=146313&r1=146312&r2=146313&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp Fri Dec  9 20:55:06 2011
@@ -26,6 +26,7 @@
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/Format.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/ADT/SmallSet.h"
 #include "llvm/ADT/SmallVector.h"
@@ -317,10 +318,16 @@
 
 /// print block size and offset information - debugging
 void ARMConstantIslands::dumpBBs() {
-  for (unsigned J = 0, E = BBInfo.size(); J !=E; ++J) {
-    DEBUG(dbgs() << "block " << J << " offset " << BBInfo[J].Offset
-                 << " size " << BBInfo[J].Size << "\n");
-  }
+  DEBUG({
+    for (unsigned J = 0, E = BBInfo.size(); J !=E; ++J) {
+      const BasicBlockInfo &BBI = BBInfo[J];
+      dbgs() << format("%08x BB#%u\t", BBI.Offset, J)
+             << " kb=" << unsigned(BBI.KnownBits)
+             << " ua=" << unsigned(BBI.Unalign)
+             << " pa=" << unsigned(BBI.PostAlign)
+             << format(" size=%#x\n", BBInfo[J].Size);
+    }
+  });
 }
 
 /// createARMConstantIslandPass - returns an instance of the constpool
@@ -332,6 +339,10 @@
 bool ARMConstantIslands::runOnMachineFunction(MachineFunction &MF) {
   MachineConstantPool &MCP = *MF.getConstantPool();
 
+  DEBUG(dbgs() << "***** ARMConstantIslands: "
+               << MCP.getConstants().size() << " CP entries, aligned to "
+               << MCP.getConstantPoolAlignment() << " bytes *****\n");
+
   TII = (const ARMInstrInfo*)MF.getTarget().getInstrInfo();
   AFI = MF.getInfo<ARMFunctionInfo>();
   STI = &MF.getTarget().getSubtarget<ARMSubtarget>();
@@ -916,11 +927,11 @@
       const BasicBlockInfo &BBI = BBInfo[Block];
       dbgs() << "User of CPE#" << CPEMI->getOperand(0).getImm()
              << " max delta=" << MaxDisp
-             << " insn address=" << UserOffset
+             << format(" insn address=%#x", UserOffset)
              << " in BB#" << Block << ": "
-             << BBI.Offset << " - " << BBI.postOffset() << "\t" << *MI
-             << "CPE address=" << CPEOffset
-             << " offset=" << int(CPEOffset-UserOffset) << ": ";
+             << format("%#x-%x\t", BBI.Offset, BBI.postOffset()) << *MI
+             << format("CPE address=%#x offset=%+d: ", CPEOffset,
+                       int(CPEOffset-UserOffset));
     });
   }
 
@@ -1308,7 +1319,7 @@
     }
 
   DEBUG(dbgs() << "  Moved CPE to #" << ID << " CPI=" << CPI
-               << '\t' << *UserMI);
+        << format(" offset=%#x\n", BBInfo[NewIsland->getNumber()].Offset));
 
   return true;
 }





More information about the llvm-commits mailing list