sink handling of target-independent machine instrs (other
authorChris Lattner <sabre@nondot.org>
Wed, 3 Feb 2010 01:00:52 +0000 (01:00 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 3 Feb 2010 01:00:52 +0000 (01:00 +0000)
than DEBUG_VALUE :(  ) into the target indep AsmPrinter.cpp
file.   This allows elimination of the
NO_ASM_WRITER_BOILERPLATE hack among other things.

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

lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp
lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp
lib/Target/MSP430/AsmPrinter/MSP430InstPrinter.cpp
lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp
lib/Target/X86/AsmPrinter/X86IntelInstPrinter.cpp
lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
utils/TableGen/AsmWriterEmitter.cpp

index fea06badcaee1ec8173b13dd0efa634c1c613dce..71668f5e25d825319ca49e7706143122a563e86a 100644 (file)
@@ -346,8 +346,25 @@ void AsmPrinter::EmitFunctionBody() {
       // FIXME: Clean up processDebugLoc.
       processDebugLoc(II, true);
       
-      EmitInstruction(II);
-      
+      switch (II->getOpcode()) {
+      case TargetInstrInfo::DBG_LABEL:
+      case TargetInstrInfo::EH_LABEL:
+      case TargetInstrInfo::GC_LABEL:
+        printLabel(II);
+        break;
+      case TargetInstrInfo::INLINEASM:
+        printInlineAsm(II);
+        break;
+      case TargetInstrInfo::IMPLICIT_DEF:
+        printImplicitDef(II);
+        break;
+      case TargetInstrInfo::KILL:
+        printKill(II);
+        break;
+      default:
+        EmitInstruction(II);
+        break;
+      }
       if (VerboseAsm)
         EmitComments(*II);
       O << '\n';
index 8c53f819e4aaba0060ed1c8aad74728d84dd3bef..3f0bd61c685dd852f93c9a4edb1ecc9586b115cb 100644 (file)
@@ -1154,20 +1154,6 @@ void ARMAsmPrinter::printInstructionThroughMCStreamer(const MachineInstr *MI) {
   case ARM::t2MOVi32imm:
     assert(0 && "Should be lowered by thumb2it pass");
   default: break;
-  case TargetInstrInfo::DBG_LABEL:
-  case TargetInstrInfo::EH_LABEL:
-  case TargetInstrInfo::GC_LABEL:
-    printLabel(MI);
-    return;
-  case TargetInstrInfo::KILL:
-    printKill(MI);
-    return;
-  case TargetInstrInfo::INLINEASM:
-    printInlineAsm(MI);
-    return;
-  case TargetInstrInfo::IMPLICIT_DEF:
-    printImplicitDef(MI);
-    return;
   case ARM::PICADD: { // FIXME: Remove asm string from td file.
     // This is a pseudo op for a label + instruction sequence, which looks like:
     // LPC0:
index 97aa351d6012828b359faacaeda0892bbc43a412..d7d8e09e12fceb9397d6cea84d1ef39cf228a30f 100644 (file)
@@ -24,7 +24,6 @@ using namespace llvm;
 // Include the auto-generated portion of the assembly writer.
 #define MachineInstr MCInst
 #define ARMAsmPrinter ARMInstPrinter  // FIXME: REMOVE.
-#define NO_ASM_WRITER_BOILERPLATE
 #include "ARMGenAsmWriter.inc"
 #undef MachineInstr
 #undef ARMAsmPrinter
index 40d9efea26a38e1d9941a87db433efb0a6e3863a..14e39f966f3e1b977287274a6e57579f2356eaaa 100644 (file)
@@ -181,27 +181,8 @@ bool MSP430AsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
 void MSP430AsmPrinter::EmitInstruction(const MachineInstr *MI) {
   MSP430MCInstLower MCInstLowering(OutContext, *Mang, *this);
 
-  switch (MI->getOpcode()) {
-  case TargetInstrInfo::DBG_LABEL:
-  case TargetInstrInfo::EH_LABEL:
-  case TargetInstrInfo::GC_LABEL:
-    printLabel(MI);
-    return;
-  case TargetInstrInfo::KILL:
-    printKill(MI);
-    return;
-  case TargetInstrInfo::INLINEASM:
-    printInlineAsm(MI);
-    return;
-  case TargetInstrInfo::IMPLICIT_DEF:
-    printImplicitDef(MI);
-    return;
-  default: break;
-  }
-
   MCInst TmpInst;
   MCInstLowering.Lower(MI, TmpInst);
-
   printMCInst(&TmpInst);
 }
 
index a4803071523e08b23b008d5f16541b2945766b90..f6565bdec6ed89faa9f5fd94dcf2aaf8e68f93a2 100644 (file)
@@ -25,7 +25,6 @@ using namespace llvm;
 
 // Include the auto-generated portion of the assembly writer.
 #define MachineInstr MCInst
-#define NO_ASM_WRITER_BOILERPLATE
 #include "MSP430GenAsmWriter.inc"
 #undef MachineInstr
 
index 804dbb927e896b116eda0d1bf0583917b269b302..81b0e8ffb790d374ddd936a0b3da2100e2326fed 100644 (file)
@@ -24,7 +24,6 @@ using namespace llvm;
 
 // Include the auto-generated portion of the assembly writer.
 #define MachineInstr MCInst
-#define NO_ASM_WRITER_BOILERPLATE
 #include "X86GenAsmWriter.inc"
 #undef MachineInstr
 
index 4efb5294fb8a6a1412f1d882812d19a041c0b1a8..4274d0a436c1c803d4b2a78786b4ad51bf2ae922 100644 (file)
@@ -24,7 +24,6 @@ using namespace llvm;
 
 // Include the auto-generated portion of the assembly writer.
 #define MachineInstr MCInst
-#define NO_ASM_WRITER_BOILERPLATE
 #include "X86GenAsmWriter1.inc"
 #undef MachineInstr
 
index 1c0e63e4d114905b27fc3c71c44f81fae18cc0b1..b45e6714db4a523bbf74de4cf60f57c5e58de2fb 100644 (file)
@@ -411,11 +411,6 @@ void X86MCInstLower::Lower(const MachineInstr *MI, MCInst &OutMI) const {
 void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
   X86MCInstLower MCInstLowering(OutContext, Mang, *this);
   switch (MI->getOpcode()) {
-  case TargetInstrInfo::DBG_LABEL:
-  case TargetInstrInfo::EH_LABEL:
-  case TargetInstrInfo::GC_LABEL:
-    printLabel(MI);
-    return;
   case TargetInstrInfo::DEBUG_VALUE: {
     // FIXME: if this is implemented for another target before it goes
     // away completely, the common part should be moved into AsmPrinter.
@@ -455,15 +450,6 @@ void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
     printOperand(MI, NOps-2);
     return;
   }
-  case TargetInstrInfo::INLINEASM:
-    printInlineAsm(MI);
-    return;
-  case TargetInstrInfo::IMPLICIT_DEF:
-    printImplicitDef(MI);
-    return;
-  case TargetInstrInfo::KILL:
-    printKill(MI);
-    return;
   case X86::MOVPC32r: {
     MCInst TmpInst;
     // This is a pseudo op for a two instruction sequence with a label, which
index ff83c767f0015551993de6b7fa7758af10b90fea..46d917872303f497899b0d105631dfc9c534e83e 100644 (file)
@@ -692,24 +692,6 @@ void AsmWriterEmitter::EmitPrintInstruction(raw_ostream &O) {
   StringTable.EmitString(O);
   O << ";\n\n";
 
-  O << "\n#ifndef NO_ASM_WRITER_BOILERPLATE\n";
-  
-  O << "  if (MI->getOpcode() == TargetInstrInfo::INLINEASM) {\n"
-    << "    printInlineAsm(MI);\n"
-    << "    return;\n"
-    << "  } else if (MI->isLabel()) {\n"
-    << "    printLabel(MI);\n"
-    << "    return;\n"
-    << "  } else if (MI->getOpcode() == TargetInstrInfo::IMPLICIT_DEF) {\n"
-    << "    printImplicitDef(MI);\n"
-    << "    return;\n"
-    << "  } else if (MI->getOpcode() == TargetInstrInfo::KILL) {\n"
-    << "    printKill(MI);\n"
-    << "    return;\n"
-    << "  }\n\n";
-
-  O << "\n#endif\n";
-
   O << "  O << \"\\t\";\n\n";
 
   O << "  // Emit the opcode for the instruction.\n"