[llvm-commits] [llvm] r137058 - /llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
Benjamin Kramer
benny.kra at googlemail.com
Mon Aug 8 11:41:34 PDT 2011
Author: d0k
Date: Mon Aug 8 13:41:34 2011
New Revision: 137058
URL: http://llvm.org/viewvc/llvm-project?rev=137058&view=rev
Log:
llvm-objdump: disassembly enhancements
- Indent simple loops
- Print unreachable blocks as .byte directives
Modified:
llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
Modified: llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp?rev=137058&r1=137057&r2=137058&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp Mon Aug 8 13:41:34 2011
@@ -284,8 +284,23 @@
break;
}
- if (!hasPreds && fi != f.begin())
+ // Data block.
+ if (!hasPreds && fi != f.begin()) {
+ uint64_t End = llvm::next(fi) == fe ? SectSize :
+ llvm::next(fi)->first;
+ uint64_t addr;
+ if (error(i->getAddress(addr))) break;
+ outs() << "# " << End-fi->first << " bytes of data:\n";
+ for (unsigned pos = fi->first; pos != End; ++pos) {
+ outs() << format("%8x:\t", addr + pos);
+ DumpBytes(StringRef(Bytes.data() + pos, 1));
+ outs() << format("\t.byte 0x%02x\n", (uint8_t)Bytes[pos]);
+ }
continue;
+ }
+
+ if (fi->second.contains(&fi->second))
+ outs() << "# Loop begin:\n";
for (unsigned ii = 0, ie = fi->second.getInsts().size(); ii != ie;
++ii) {
@@ -294,6 +309,9 @@
const MCDecodedInst &Inst = fi->second.getInsts()[ii];
outs() << format("%8x:\t", addr + Inst.Address);
DumpBytes(StringRef(Bytes.data() + Inst.Address, Inst.Size));
+ // Simple loops.
+ if (fi->second.contains(&fi->second))
+ outs() << '\t';
IP->printInst(&Inst.Inst, outs());
outs() << '\n';
}
More information about the llvm-commits
mailing list