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 | 04047fbe1446b160257a2f3949aa4fb2e30dba78 (patch) | |
| tree | 061ca8cf0e87b8959626bb853b7fd5b6f444714b /llvm/lib/MC/MCInst.cpp | |
| parent | 65f7a3f801de0661361c17a71a59c8cf26b465d0 (diff) | |
| download | bcm5719-llvm-04047fbe1446b160257a2f3949aa4fb2e30dba78.tar.gz bcm5719-llvm-04047fbe1446b160257a2f3949aa4fb2e30dba78.zip | |
MCInst: Add ::dump_pretty.
llvm-svn: 99216
Diffstat (limited to 'llvm/lib/MC/MCInst.cpp')
| -rw-r--r-- | llvm/lib/MC/MCInst.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCInst.cpp b/llvm/lib/MC/MCInst.cpp index 0634c9faf6f..de142dc9553 100644 --- a/llvm/lib/MC/MCInst.cpp +++ b/llvm/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"; |

