From 07e376bd0de0ae8451c9036310e670f098555c7a Mon Sep 17 00:00:00 2001 From: Misha Brukman Date: Fri, 13 Dec 2002 04:24:53 +0000 Subject: [PATCH] Moves now select correct opcode based on the data size. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4981 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86RegisterInfo.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/lib/Target/X86/X86RegisterInfo.cpp b/lib/Target/X86/X86RegisterInfo.cpp index a1ed317bd68..cd22d88efbd 100644 --- a/lib/Target/X86/X86RegisterInfo.cpp +++ b/lib/Target/X86/X86RegisterInfo.cpp @@ -23,7 +23,6 @@ X86RegisterInfo::X86RegisterInfo() : MRegisterInfo(X86Regs, sizeof(X86Regs)/sizeof(X86Regs[0])) { } - MachineBasicBlock::iterator X86RegisterInfo::storeReg2RegOffset(MachineBasicBlock *MBB, MachineBasicBlock::iterator MBBI, @@ -31,7 +30,15 @@ X86RegisterInfo::storeReg2RegOffset(MachineBasicBlock *MBB, unsigned ImmOffset, unsigned dataSize) const { - MachineInstr *MI = addRegOffset(BuildMI(X86::MOVrm32, 5), + unsigned opcode; + switch (dataSize) { + case 1: opcode = X86::MOVrm8; break; + case 2: opcode = X86::MOVrm16; break; + case 4: opcode = X86::MOVrm32; break; + default: assert(0 && "Invalid data size!"); + } + + MachineInstr *MI = addRegOffset(BuildMI(opcode, 5), DestReg, ImmOffset).addReg(SrcReg); return ++(MBB->insert(MBBI, MI)); } @@ -43,7 +50,15 @@ X86RegisterInfo::loadRegOffset2Reg(MachineBasicBlock *MBB, unsigned ImmOffset, unsigned dataSize) const { - MachineInstr *MI = addRegOffset(BuildMI(X86::MOVmr32, 5).addReg(DestReg), + unsigned opcode; + switch (dataSize) { + case 1: opcode = X86::MOVmr8; break; + case 2: opcode = X86::MOVmr16; break; + case 4: opcode = X86::MOVmr32; break; + default: assert(0 && "Invalid data size!"); + } + + MachineInstr *MI = addRegOffset(BuildMI(opcode, 5).addReg(DestReg), SrcReg, ImmOffset); return ++(MBB->insert(MBBI, MI)); } -- 2.34.1