Add virtual printMCInst method to AsmPrinter, as a quick way to expose the API
authorDaniel Dunbar <daniel@zuster.org>
Fri, 14 Aug 2009 03:43:57 +0000 (03:43 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Fri, 14 Aug 2009 03:43:57 +0000 (03:43 +0000)
to print one instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78985 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/AsmPrinter.h
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h

index ff5a7763dd8c07f96bd21bc70837e9a62fba3607..efbcef1b8149e47810b106a2d52707b8a862c680 100644 (file)
@@ -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.
     ///
index 6d1c7da1e181a3513e0691c28b757a2e79b80749..02ff2f0b50ad8bcb4d1cfc8b05a24d2e94ca43f6 100644 (file)
@@ -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;
index 7839b74ce686fcff12943ae01bac78f618149f60..3d297d69accbdf6f59e61a1745f103a742216d0e 100644 (file)
@@ -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);