summaryrefslogtreecommitdiff
path: root/lib/Target/X86/X86InstrInfo.cpp
diff options
context:
space:
mode:
authorChristopher Lamb <christopher.lamb@gmail.com>2008-03-16 03:12:01 +0000
committerChristopher Lamb <christopher.lamb@gmail.com>2008-03-16 03:12:01 +0000
commitc9298235251b014e86a7368d92b589d093acb64a (patch)
tree11c2e0c245fb52c02a65e3e9469f5f83e94abaee /lib/Target/X86/X86InstrInfo.cpp
parent606c5aa084041eb5ad60710728098eaf9c997315 (diff)
downloadllvm-c9298235251b014e86a7368d92b589d093acb64a.tar.gz
llvm-c9298235251b014e86a7368d92b589d093acb64a.tar.bz2
llvm-c9298235251b014e86a7368d92b589d093acb64a.tar.xz
Make insert_subreg a two-address instruction, vastly simplifying LowerSubregs pass. Add a new TII, subreg_to_reg, which is like insert_subreg except that it takes an immediate implicit value to insert into rather than a register.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48412 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86InstrInfo.cpp')
-rw-r--r--lib/Target/X86/X86InstrInfo.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Target/X86/X86InstrInfo.cpp b/lib/Target/X86/X86InstrInfo.cpp
index ff666ff3c2..650ab415ee 100644
--- a/lib/Target/X86/X86InstrInfo.cpp
+++ b/lib/Target/X86/X86InstrInfo.cpp
@@ -920,10 +920,11 @@ X86InstrInfo::convertToThreeAddress(MachineFunction::iterator &MFI,
// Build and insert into an implicit UNDEF value. This is OK because
// well be shifting and then extracting the lower 16-bits.
+ MachineInstr *Undef = BuildMI(get(X86::IMPLICIT_DEF), leaInReg);
+
MachineInstr *Ins =
BuildMI(get(X86::INSERT_SUBREG),leaInReg)
- .addImm(X86InstrInfo::IMPL_VAL_UNDEF)
- .addReg(Src).addImm(X86::SUBREG_16BIT);
+ .addReg(leaInReg).addReg(Src).addImm(X86::SUBREG_16BIT);
NewMI = BuildMI(get(Opc), leaOutReg)
.addReg(0).addImm(1 << ShAmt).addReg(leaInReg).addImm(0);
@@ -933,6 +934,7 @@ X86InstrInfo::convertToThreeAddress(MachineFunction::iterator &MFI,
.addReg(leaOutReg).addImm(X86::SUBREG_16BIT);
Ext->copyKillDeadInfo(MI);
+ MFI->insert(MBBI, Undef);
MFI->insert(MBBI, Ins); // Insert the insert_subreg
LV.instructionChanged(MI, NewMI); // Update live variables
LV.addVirtualRegisterKilled(leaInReg, NewMI);