diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-03-22 21:49:34 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-03-22 21:49:34 +0000 |
commit | 67c076cf59d14fc96feb5c915447f8ea79cf8325 (patch) | |
tree | e676c343c12b0facebe91324bd2e451e879afa4c /lib/MC/MCInst.cpp | |
parent | a69ec09364213311f1ced39271a30f39076b207e (diff) |
MCInst: Add ::dump_pretty.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99216 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCInst.cpp')
-rw-r--r-- | lib/MC/MCInst.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/MC/MCInst.cpp b/lib/MC/MCInst.cpp index 0634c9faf6..de142dc955 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"; |