[PATCH] Add method to MCInstPrinter for printing with disassembly context

Rafael Ávila de Espíndola rafael.espindola at gmail.com
Thu Mar 19 13:25:22 PDT 2015


I think this is fine with a few changes.

Do you have the patch actually using this ready somewhere?


REPOSITORY
  rL LLVM

================
Comment at: include/llvm/MC/MCInstPrinter.h:26
@@ +25,3 @@
+/// Convert `Bytes' to a hex string and output to `OS'
+void DumpBytes(ArrayRef<uint8_t> Bytes, raw_ostream &OS);
+
----------------
dumpBytes

================
Comment at: lib/MC/MCInstPrinter.cpp:20
@@ -18,1 +19,3 @@
 
+void llvm::DumpBytes(ArrayRef<uint8_t> bytes, raw_ostream &OS) {
+  static const char hex_rep[] = "0123456789abcdef";
----------------
This can now be static, no?

================
Comment at: lib/MC/MCInstPrinter.cpp:26
@@ +25,3 @@
+    output.push_back(hex_rep[(i & 0xF0) >> 4]);
+    output.push_back(hex_rep[i & 0xF]);
+    output.push_back(' ');
----------------
Why not send the chars to OS directly?

http://reviews.llvm.org/D8427

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list