summaryrefslogtreecommitdiffstats
path: root/lib/MC/MCInst.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/MC/MCInst.cpp')
-rw-r--r--lib/MC/MCInst.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/MC/MCInst.cpp b/lib/MC/MCInst.cpp
index 0634c9f..de142dc 100644
--- a/lib/MC/MCInst.cpp
+++ b/lib/MC/MCInst.cpp
@@ -9,6 +9,7 @@
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCExpr.h"
+#include "llvm/MC/MCInstPrinter.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
@@ -43,6 +44,22 @@ void MCInst::print(raw_ostream &OS, const MCAsmInfo *MAI) const {
OS << ">";
}
+void MCInst::dump_pretty(raw_ostream &OS, const MCAsmInfo *MAI,
+ const MCInstPrinter *Printer,
+ StringRef Separator) const {
+ OS << "<MCInst #" << getOpcode();
+
+ // Show the instruction opcode name if we have access to a printer.
+ if (Printer)
+ OS << ' ' << Printer->getOpcodeName(getOpcode());
+
+ for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
+ OS << Separator;
+ getOperand(i).print(OS, MAI);
+ }
+ OS << ">\n";
+}
+
void MCInst::dump() const {
print(dbgs(), 0);
dbgs() << "\n";
OpenPOWER on IntegriCloud