aboutsummaryrefslogtreecommitdiff
path: root/lib/MC/MCAsmStreamer.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-08-27 07:58:57 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-08-27 07:58:57 +0000
commita356aea804462fc4a10c8d8c247d1589901316b4 (patch)
treedf87fc26a01b2a30e0d8963600dfb799d2cce20b /lib/MC/MCAsmStreamer.cpp
parent1ca3a0bf2274ca6043f9d349b27679abf98b3624 (diff)
llvm-mc: Print encodings after the instruction, and only when we have an asm
printer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80233 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCAsmStreamer.cpp')
-rw-r--r--lib/MC/MCAsmStreamer.cpp35
1 files changed, 18 insertions, 17 deletions
diff --git a/lib/MC/MCAsmStreamer.cpp b/lib/MC/MCAsmStreamer.cpp
index 9ea9b4342c..60c737a948 100644
--- a/lib/MC/MCAsmStreamer.cpp
+++ b/lib/MC/MCAsmStreamer.cpp
@@ -295,26 +295,27 @@ static raw_ostream &operator<<(raw_ostream &OS, const MCOperand &Op) {
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;
}