[llvm-commits] [llvm] r80233 - /llvm/trunk/lib/MC/MCAsmStreamer.cpp

Daniel Dunbar daniel at zuster.org
Thu Aug 27 00:58:57 PDT 2009


Author: ddunbar
Date: Thu Aug 27 02:58:57 2009
New Revision: 80233

URL: http://llvm.org/viewvc/llvm-project?rev=80233&view=rev
Log:
llvm-mc: Print encodings after the instruction, and only when we have an asm
printer.

Modified:
    llvm/trunk/lib/MC/MCAsmStreamer.cpp

Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=80233&r1=80232&r2=80233&view=diff

==============================================================================
--- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Thu Aug 27 02:58:57 2009
@@ -295,26 +295,27 @@
 void MCAsmStreamer::EmitInstruction(const MCInst &Inst) {
   assert(CurSection && "Cannot emit contents before setting section!");
 
-  // Show the encoding if we have a code emitter.
-  if (Emitter) {
-    SmallString<256> Code;
-    raw_svector_ostream VecOS(Code);
-    Emitter->EncodeInstruction(Inst, VecOS);
-    VecOS.flush();
-
-    OS.indent(20);
-    OS << " # encoding: [";
-    for (unsigned i = 0, e = Code.size(); i != e; ++i) {
-      if (i + 1 != e)
-        OS << ',';
-      OS << format("%#04x", Code[i]);
-    }
-    OS << "]\n";
-  }
-
   // If we have an AsmPrinter, use that to print.
   if (Printer) {
     Printer->printMCInst(&Inst);
+
+    // Show the encoding if we have a code emitter.
+    if (Emitter) {
+      SmallString<256> Code;
+      raw_svector_ostream VecOS(Code);
+      Emitter->EncodeInstruction(Inst, VecOS);
+      VecOS.flush();
+  
+      OS.indent(20);
+      OS << " # encoding: [";
+      for (unsigned i = 0, e = Code.size(); i != e; ++i) {
+        if (i)
+          OS << ',';
+        OS << format("%#04x", uint8_t(Code[i]));
+      }
+      OS << "]\n";
+    }
+
     return;
   }
 





More information about the llvm-commits mailing list