OSDN Git Service

Move hacks up
authorChris Lattner <sabre@nondot.org>
Wed, 11 Aug 2004 06:09:55 +0000 (06:09 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 11 Aug 2004 06:09:55 +0000 (06:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15654 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86AsmPrinter.cpp

index a17d5d5..305d724 100644 (file)
@@ -49,7 +49,6 @@ namespace {
 
     ~GasBugWorkaroundEmitter() {
       O.flags(OldFlags);
-      O << "\t# ";
     }
 
     virtual void emitByte(unsigned char B) {
@@ -586,6 +585,36 @@ bool X86AsmPrinter::printImplUsesAfter(const TargetInstrDescriptor &Desc,
 ///
 void X86AsmPrinter::printMachineInstruction(const MachineInstr *MI) {
   ++EmittedInsts;
+
+  // gas bugs:
+  //
+  // The 80-bit FP store-pop instruction "fstp XWORD PTR [...]"  is misassembled
+  // by gas in intel_syntax mode as its 32-bit equivalent "fstp DWORD PTR
+  // [...]". Workaround: Output the raw opcode bytes instead of the instruction.
+  //
+  // The 80-bit FP load instruction "fld XWORD PTR [...]" is misassembled by gas
+  // in intel_syntax mode as its 32-bit equivalent "fld DWORD PTR
+  // [...]". Workaround: Output the raw opcode bytes instead of the instruction.
+  //
+  // gas intel_syntax mode treats "fild QWORD PTR [...]" as an invalid opcode,
+  // saying "64 bit operations are only supported in 64 bit modes." libopcodes
+  // disassembles it as "fild DWORD PTR [...]", which is wrong. Workaround:
+  // Output the raw opcode bytes instead of the instruction.
+  //
+  // gas intel_syntax mode treats "fistp QWORD PTR [...]" as an invalid opcode,
+  // saying "64 bit operations are only supported in 64 bit modes." libopcodes
+  // disassembles it as "fistpll DWORD PTR [...]", which is wrong. Workaround:
+  // Output the raw opcode bytes instead of the instruction.
+  switch (MI->getOpcode()) {
+  case X86::FSTP80m:
+  case X86::FLD80m:
+  case X86::FILD64m:
+  case X86::FISTP64m:
+    GasBugWorkaroundEmitter gwe(O);
+    X86::emitInstruction(gwe, (X86InstrInfo&)*TM.getInstrInfo(), *MI);
+    O << "\t# ";
+  }
+
   if (printInstruction(MI))
     return;   // Printer was automatically generated
 
@@ -853,37 +882,6 @@ void X86AsmPrinter::printMachineInstruction(const MachineInstr *MI) {
 
     const MachineOperand &Op3 = MI->getOperand(3);
 
-    // gas bugs:
-    //
-    // The 80-bit FP store-pop instruction "fstp XWORD PTR [...]"
-    // is misassembled by gas in intel_syntax mode as its 32-bit
-    // equivalent "fstp DWORD PTR [...]". Workaround: Output the raw
-    // opcode bytes instead of the instruction.
-    //
-    // The 80-bit FP load instruction "fld XWORD PTR [...]" is
-    // misassembled by gas in intel_syntax mode as its 32-bit
-    // equivalent "fld DWORD PTR [...]". Workaround: Output the raw
-    // opcode bytes instead of the instruction.
-    //
-    // gas intel_syntax mode treats "fild QWORD PTR [...]" as an
-    // invalid opcode, saying "64 bit operations are only supported in
-    // 64 bit modes." libopcodes disassembles it as "fild DWORD PTR
-    // [...]", which is wrong. Workaround: Output the raw opcode bytes
-    // instead of the instruction.
-    //
-    // gas intel_syntax mode treats "fistp QWORD PTR [...]" as an
-    // invalid opcode, saying "64 bit operations are only supported in
-    // 64 bit modes." libopcodes disassembles it as "fistpll DWORD PTR
-    // [...]", which is wrong. Workaround: Output the raw opcode bytes
-    // instead of the instruction.
-    if (MI->getOpcode() == X86::FSTP80m ||
-        MI->getOpcode() == X86::FLD80m ||
-        MI->getOpcode() == X86::FILD64m ||
-        MI->getOpcode() == X86::FISTP64m) {
-      GasBugWorkaroundEmitter gwe(O);
-      X86::emitInstruction(gwe, (X86InstrInfo&)*TM.getInstrInfo(), *MI);
-    }
-
     O << TII.getName(MI->getOpcode()) << " ";
     O << sizePtr(Desc) << " ";
     printMemReference(MI, 0);