Don't attach annotations to MCInst's. Instead, have the disassembler return, and the printer accept, an annotation string which can be passed through if the client cares about annotations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139876 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp b/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp
index 8f34b19..c22b13a 100644
--- a/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp
+++ b/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp
@@ -31,7 +31,8 @@
OS << getRegisterName(RegNo);
}
-void PPCInstPrinter::printInst(const MCInst *MI, raw_ostream &O) {
+void PPCInstPrinter::printInst(const MCInst *MI, raw_ostream &O,
+ StringRef Annot) {
// Check for slwi/srwi mnemonics.
if (MI->getOpcode() == PPC::RLWINM) {
unsigned char SH = MI->getOperand(2).getImm();
@@ -50,6 +51,8 @@
O << ", ";
printOperand(MI, 1, O);
O << ", " << (unsigned int)SH;
+
+ if (CommentStream) printAnnotation(*CommentStream, Annot);
return;
}
}
@@ -60,6 +63,7 @@
printOperand(MI, 0, O);
O << ", ";
printOperand(MI, 1, O);
+ if (CommentStream) printAnnotation(*CommentStream, Annot);
return;
}
@@ -73,11 +77,13 @@
O << ", ";
printOperand(MI, 1, O);
O << ", " << (unsigned int)SH;
+ if (CommentStream) printAnnotation(*CommentStream, Annot);
return;
}
}
printInstruction(MI, O);
+ if (CommentStream) printAnnotation(*CommentStream, Annot);
}