Fix the last crimes against nature that used the 'ir' ordering to use the
[oota-llvm.git] / lib / Target / X86 / X86AsmPrinter.cpp
index f591612aea30ea58e7c63fc1643dc03f10d876f2..1b70773b533b7b24756c898e9050f2fc62ff4594 100644 (file)
@@ -399,7 +399,7 @@ void Printer::printOp(const MachineOperand &MO,
     }
     // FALLTHROUGH
   case MachineOperand::MO_MachineRegister:
-    if (MO.getReg() < MRegisterInfo::FirstVirtualRegister)
+    if (MRegisterInfo::isPhysicalRegister(MO.getReg()))
       // Bug Workaround: See note in Printer::doInitialization about %.
       O << "%" << RI.get(MO.getReg()).Name;
     else
@@ -642,13 +642,19 @@ void Printer::printMachineInstruction(const MachineInstr *MI) {
     // These instructions are the same as MRMDestReg, but instead of having a
     // register reference for the mod/rm field, it's a memory reference.
     //
-    assert(isMem(MI, 0) && MI->getNumOperands() == 4+1 &&
-           MI->getOperand(4).isRegister() && "Bad format for MRMDestMem!");
+    assert(isMem(MI, 0) && 
+           (MI->getNumOperands() == 4+1 ||
+            (MI->getNumOperands() == 4+2 && MI->getOperand(5).isImmediate()))
+           && "Bad format for MRMDestMem!");
 
     O << TII.getName(MI->getOpcode()) << " " << sizePtr(Desc) << " ";
     printMemReference(MI, 0);
     O << ", ";
     printOp(MI->getOperand(4));
+    if (MI->getNumOperands() == 4+2) {
+      O << ", ";
+      printOp(MI->getOperand(5));
+    }
     O << "\n";
     return;
   }
@@ -665,7 +671,7 @@ void Printer::printMachineInstruction(const MachineInstr *MI) {
     // like: add r32, r/m32
     //
     // 3 Operands: in this form, we can have 'INST R1, R2, imm', which is used
-    // for instructions like the IMULri instructions.
+    // for instructions like the IMULrri instructions.
     //
     //
     assert(MI->getOperand(0).isRegister() &&