add a hack to lower MOV16r0 to MOV32r0 in MCInstLower, eliminating
authorChris Lattner <sabre@nondot.org>
Tue, 8 Sep 2009 05:49:25 +0000 (05:49 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 8 Sep 2009 05:49:25 +0000 (05:49 +0000)
the problem with subreg32 modifiers.  This gets all of Olden working
with the new asmprinter.

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

lib/Target/X86/AsmPrinter/X86MCInstLower.cpp

index 0a1f87e7996e33efd919dd4f4f1b2ce68ac920c3..7cafe83fc7a8195937f7bb01c28f8929954fb383 100644 (file)
@@ -39,6 +39,13 @@ MCSymbol *X86ATTAsmPrinter::GetPICBaseSymbol() {
 }
 
 
+static void lower_subreg32(MCInst *MI, unsigned OpNo) {
+  // Convert registers in the addr mode according to subreg32.
+  unsigned Reg = MI->getOperand(OpNo).getReg();
+  if (Reg != 0)
+    MI->getOperand(OpNo).setReg(getX86SubSuperRegister(Reg, MVT::i32));
+}
+
 
 static void lower_lea64_32mem(MCInst *MI, unsigned OpNo) {
   // Convert registers in the addr mode according to subreg64.
@@ -302,6 +309,11 @@ printInstructionThroughMCStreamer(const MachineInstr *MI) {
     // Handle the 'subreg rewriting' for the lea64_32mem operand.
     lower_lea64_32mem(&TmpInst, 1);
     break;
+      
+  case X86::MOV16r0:
+    TmpInst.setOpcode(X86::MOV32r0);
+    lower_subreg32(&TmpInst, 0);
+    break;
   }
   
   printInstruction(&TmpInst);