Undo 58778 but makes the binary dump prettier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58782 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/ExecutionEngine/JIT/JITEmitter.cpp b/lib/ExecutionEngine/JIT/JITEmitter.cpp
index 98822c8..0732806 100644
--- a/lib/ExecutionEngine/JIT/JITEmitter.cpp
+++ b/lib/ExecutionEngine/JIT/JITEmitter.cpp
@@ -38,6 +38,9 @@
#include "llvm/ADT/Statistic.h"
#include <algorithm>
#include <set>
+#ifndef NDEBUG
+#include <iomanip>
+#endif
using namespace llvm;
STATISTIC(NumBytes, "Number of bytes of machine code compiled");
@@ -954,9 +957,24 @@
MemMgr->setMemoryExecutable();
#ifndef NDEBUG
- if (sys::hasDisassembler())
- DOUT << "Disassembled code:\n"
- << sys::disassembleBuffer(FnStart, FnEnd-FnStart, (uintptr_t)FnStart);
+ {
+ if (sys::hasDisassembler())
+ DOUT << "Disassembled code:\n"
+ << sys::disassembleBuffer(FnStart, FnEnd-FnStart, (uintptr_t)FnStart);
+ else {
+ DOUT << std::hex;
+ int i;
+ unsigned char* q = FnStart;
+ for (i=1; q!=FnEnd; q++, i++) {
+ if (i%8==1)
+ DOUT << "0x" << (long)q << ": ";
+ DOUT<< std::setw(2) << std::setfill('0') << (unsigned short)*q << " ";
+ if (i%8==0)
+ DOUT<<"\n";
+ }
+ DOUT << std::dec;
+ }
+ }
#endif
if (ExceptionHandling) {
uintptr_t ActualSize = 0;