From: Daniel Dunbar Date: Fri, 14 Aug 2009 03:43:57 +0000 (+0000) Subject: Add virtual printMCInst method to AsmPrinter, as a quick way to expose the API X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=575327b77e9092074e5d18bfebfb78ce550aa2a3;p=oota-llvm.git Add virtual printMCInst method to AsmPrinter, as a quick way to expose the API to print one instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78985 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/CodeGen/AsmPrinter.h b/include/llvm/CodeGen/AsmPrinter.h index ff5a7763dd8..efbcef1b814 100644 --- a/include/llvm/CodeGen/AsmPrinter.h +++ b/include/llvm/CodeGen/AsmPrinter.h @@ -345,6 +345,12 @@ namespace llvm { /// EmitComments - Pretty-print comments for basic blocks void EmitComments(const MachineBasicBlock &MBB) const; + /// printMCInst - Print an MCInst for this target. + /// + /// Note, this is only a temporary hack to allow the MCStreamer to print + /// instructions, do not use this function outside of llvm-mc. + virtual void printMCInst(const MCInst *MI); + protected: /// EmitZeros - Emit a block of zeros. /// diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 6d1c7da1e18..02ff2f0b50a 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -1738,6 +1738,10 @@ void AsmPrinter::printOffset(int64_t Offset) const { O << Offset; } +void AsmPrinter::printMCInst(const MCInst *MI) { + llvm_unreachable("MCInst printing unavailable on this target!"); +} + GCMetadataPrinter *AsmPrinter::GetOrCreateGCPrinter(GCStrategy *S) { if (!S->usesMetadata()) return 0; diff --git a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h index 7839b74ce68..3d297d69acc 100644 --- a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h +++ b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h @@ -67,6 +67,8 @@ class VISIBILITY_HIDDEN X86ATTAsmPrinter : public AsmPrinter { // New MCInst printing stuff. void printInstruction(const MCInst *MI); + virtual void printMCInst(const MCInst *MI) { printInstruction(MI); } + void printSymbolOperand(const MachineOperand &MO); void printOperand(const MCInst *MI, unsigned OpNo, const char *Modifier = 0);