From 7ffa3c80294a2a55b5945b2a6bab43354c801033 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 8 Sep 2009 05:49:25 +0000 Subject: [PATCH] add a hack to lower MOV16r0 to MOV32r0 in MCInstLower, eliminating 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 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp b/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp index 0a1f87e7996..7cafe83fc7a 100644 --- a/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp +++ b/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp @@ -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); -- 2.34.1