diff options
| author | Christopher Lamb <christopher.lamb@gmail.com> | 2008-03-10 06:12:08 +0000 |
|---|---|---|
| committer | Christopher Lamb <christopher.lamb@gmail.com> | 2008-03-10 06:12:08 +0000 |
| commit | 3feb0170a8d65984ce5c01a85e7dfd4005f8bb35 (patch) | |
| tree | ca6ec84f80cafe500a012b1aab9a96e34a305084 /lib/Target/X86/X86InstrInfo.cpp | |
| parent | 7e93e16193553419a7e9907d6dbe41e6393aff4e (diff) | |
Allow insert_subreg into implicit, target-specific values.
Change insert/extract subreg instructions to be able to be used in TableGen patterns.
Use the above features to reimplement an x86-64 pseudo instruction as a pattern.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48130 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86InstrInfo.cpp')
| -rw-r--r-- | lib/Target/X86/X86InstrInfo.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Target/X86/X86InstrInfo.cpp b/lib/Target/X86/X86InstrInfo.cpp index 3c12fa1735..b5881309b2 100644 --- a/lib/Target/X86/X86InstrInfo.cpp +++ b/lib/Target/X86/X86InstrInfo.cpp @@ -903,16 +903,20 @@ X86InstrInfo::convertToThreeAddress(MachineFunction::iterator &MFI, ? X86::LEA64_32r : X86::LEA32r; unsigned leaInReg = RegInfo.createVirtualRegister(&X86::GR32RegClass); unsigned leaOutReg = RegInfo.createVirtualRegister(&X86::GR32RegClass); - - MachineInstr *Ins = - BuildMI(get(X86::INSERT_SUBREG), leaInReg).addReg(Src).addImm(2); + + // Build and insert into an implicit UNDEF value. This is OK because + // well be shifting and then extracting the lower 16-bits. + MachineInstr *Ins = + BuildMI(get(X86::INSERT_SUBREG),leaInReg).addImm(X86::IMPL_VAL_UNDEF) + .addReg(Src).addImm(X86::SUBREG_16BIT); Ins->copyKillDeadInfo(MI); NewMI = BuildMI(get(Opc), leaOutReg) .addReg(0).addImm(1 << ShAmt).addReg(leaInReg).addImm(0); MachineInstr *Ext = - BuildMI(get(X86::EXTRACT_SUBREG), Dest).addReg(leaOutReg).addImm(2); + BuildMI(get(X86::EXTRACT_SUBREG), Dest) + .addReg(leaOutReg).addImm(X86::SUBREG_16BIT); Ext->copyKillDeadInfo(MI); MFI->insert(MBBI, Ins); // Insert the insert_subreg |
