[llvm-commits] CVS: llvm/lib/Target/X86/Printer.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Mar 31 16:04:05 PST 2004


Changes in directory llvm/lib/Target/X86:

Printer.cpp updated: 1.94 -> 1.95

---
Log message:

Add support for FP cmoves


---
Diffs of the changes:  (+28 -10)

Index: llvm/lib/Target/X86/Printer.cpp
diff -u llvm/lib/Target/X86/Printer.cpp:1.94 llvm/lib/Target/X86/Printer.cpp:1.95
--- llvm/lib/Target/X86/Printer.cpp:1.94	Thu Mar 11 13:08:24 2004
+++ llvm/lib/Target/X86/Printer.cpp	Wed Mar 31 16:02:21 2004
@@ -104,7 +104,8 @@
       return "X86 Assembly Printer";
     }
 
-    void checkImplUses (const TargetInstrDescriptor &Desc);
+    void printImplUsesBefore(const TargetInstrDescriptor &Desc);
+    void printImplUsesAfter(const TargetInstrDescriptor &Desc);
     void printMachineInstruction(const MachineInstr *MI);
     void printOp(const MachineOperand &MO,
 		 bool elideOffsetKeyword = false);
@@ -528,12 +529,26 @@
   O << "]";
 }
 
-/// checkImplUses - Emit the implicit-use registers for the
-/// instruction described by DESC, if its PrintImplUses flag is set.
+
+/// printImplUsesBefore - Emit the implicit-use registers for the instruction
+/// described by DESC, if its PrintImplUsesBefore flag is set.
 ///
-void Printer::checkImplUses (const TargetInstrDescriptor &Desc) {
+void Printer::printImplUsesBefore(const TargetInstrDescriptor &Desc) {
   const MRegisterInfo &RI = *TM.getRegisterInfo();
-  if (Desc.TSFlags & X86II::PrintImplUses) {
+  if (Desc.TSFlags & X86II::PrintImplUsesBefore) {
+    for (const unsigned *p = Desc.ImplicitUses; *p; ++p) {
+      // Bug Workaround: See note in Printer::doInitialization about %.
+      O << "%" << RI.get(*p).Name << ", ";
+    }
+  }
+}
+
+/// printImplUsesAfter - Emit the implicit-use registers for the instruction
+/// described by DESC, if its PrintImplUsesAfter flag is set.
+///
+void Printer::printImplUsesAfter(const TargetInstrDescriptor &Desc) {
+  const MRegisterInfo &RI = *TM.getRegisterInfo();
+  if (Desc.TSFlags & X86II::PrintImplUsesAfter) {
     for (const unsigned *p = Desc.ImplicitUses; *p; ++p) {
       // Bug Workaround: See note in Printer::doInitialization about %.
       O << ", %" << RI.get(*p).Name;
@@ -628,6 +643,9 @@
     unsigned Reg = MI->getOperand(0).getReg();
     
     O << TII.getName(MI->getOpcode()) << " ";
+
+    printImplUsesBefore(Desc);   // fcmov*
+
     printOp(MI->getOperand(0));
     if (MI->getNumOperands() == 2 &&
 	(!MI->getOperand(1).isRegister() ||
@@ -637,7 +655,7 @@
       O << ", ";
       printOp(MI->getOperand(1));
     }
-    checkImplUses(Desc);
+    printImplUsesAfter(Desc);
     O << "\n";
     return;
   }
@@ -668,7 +686,7 @@
       O << ", ";
       printOp(MI->getOperand(2));
     }
-    checkImplUses(Desc);
+    printImplUsesAfter(Desc);
     O << "\n";
     return;
   }
@@ -690,7 +708,7 @@
       O << ", ";
       printOp(MI->getOperand(5));
     }
-    checkImplUses(Desc);
+    printImplUsesAfter(Desc);
     O << "\n";
     return;
   }
@@ -778,7 +796,7 @@
       O << ", ";
       printOp(MI->getOperand(MI->getNumOperands()-1));
     }
-    checkImplUses(Desc);
+    printImplUsesAfter(Desc);
     O << "\n";
 
     return;
@@ -841,7 +859,7 @@
       O << ", ";
       printOp(MI->getOperand(4));
     }
-    checkImplUses(Desc);
+    printImplUsesAfter(Desc);
     O << "\n";
     return;
   }





More information about the llvm-commits mailing list