diff options
author | Christopher Lamb <christopher.lamb@gmail.com> | 2008-03-11 10:09:17 +0000 |
---|---|---|
committer | Christopher Lamb <christopher.lamb@gmail.com> | 2008-03-11 10:09:17 +0000 |
commit | d0c8eaaf4275ec4f39b0798393a9dc5182100f4b (patch) | |
tree | d3213aafa049b1bd65de0edc9e7e4754eff9221e /lib/CodeGen/LowerSubregs.cpp | |
parent | 76616b303cc3154f11c225e1258c20397a8b16aa (diff) | |
download | external_llvm-d0c8eaaf4275ec4f39b0798393a9dc5182100f4b.zip external_llvm-d0c8eaaf4275ec4f39b0798393a9dc5182100f4b.tar.gz external_llvm-d0c8eaaf4275ec4f39b0798393a9dc5182100f4b.tar.bz2 |
Recommitting parts of r48130. These do not appear to cause the observed failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48223 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LowerSubregs.cpp')
-rw-r--r-- | lib/CodeGen/LowerSubregs.cpp | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/lib/CodeGen/LowerSubregs.cpp b/lib/CodeGen/LowerSubregs.cpp index 61601d5..531713e 100644 --- a/lib/CodeGen/LowerSubregs.cpp +++ b/lib/CodeGen/LowerSubregs.cpp @@ -90,32 +90,21 @@ bool LowerSubregsInstructionPass::LowerInsert(MachineInstr *MI) { MachineFunction &MF = *MBB->getParent(); const TargetRegisterInfo &TRI = *MF.getTarget().getRegisterInfo(); const TargetInstrInfo &TII = *MF.getTarget().getInstrInfo(); - unsigned DstReg = 0; + assert((MI->getOperand(0).isRegister() && MI->getOperand(0).isDef()) && + ((MI->getOperand(1).isRegister() && MI->getOperand(1).isUse()) || + MI->getOperand(1).isImmediate()) && + (MI->getOperand(2).isRegister() && MI->getOperand(2).isUse()) && + MI->getOperand(3).isImmediate() && "Invalid insert_subreg"); + + unsigned DstReg = MI->getOperand(0).getReg(); unsigned SrcReg = 0; - unsigned InsReg = 0; - unsigned SubIdx = 0; - - // If only have 3 operands, then the source superreg is undef - // and we can supress the copy from the undef value - if (MI->getNumOperands() == 3) { - assert((MI->getOperand(0).isRegister() && MI->getOperand(0).isDef()) && - (MI->getOperand(1).isRegister() && MI->getOperand(1).isUse()) && - MI->getOperand(2).isImmediate() && "Invalid extract_subreg"); - DstReg = MI->getOperand(0).getReg(); + // Check if we're inserting into an implicit value. + if (MI->getOperand(1).isImmediate()) SrcReg = DstReg; - InsReg = MI->getOperand(1).getReg(); - SubIdx = MI->getOperand(2).getImm(); - } else if (MI->getNumOperands() == 4) { - assert((MI->getOperand(0).isRegister() && MI->getOperand(0).isDef()) && - (MI->getOperand(1).isRegister() && MI->getOperand(1).isUse()) && - (MI->getOperand(2).isRegister() && MI->getOperand(2).isUse()) && - MI->getOperand(3).isImmediate() && "Invalid extract_subreg"); - DstReg = MI->getOperand(0).getReg(); + else SrcReg = MI->getOperand(1).getReg(); - InsReg = MI->getOperand(2).getReg(); - SubIdx = MI->getOperand(3).getImm(); - } else - assert(0 && "Malformed extract_subreg"); + unsigned InsReg = MI->getOperand(2).getReg(); + unsigned SubIdx = MI->getOperand(3).getImm(); assert(SubIdx != 0 && "Invalid index for extract_subreg"); unsigned DstSubReg = TRI.getSubReg(DstReg, SubIdx); |