[llvm-commits] [llvm] r103124 - /llvm/trunk/lib/Target/ARM/NEONPreAllocPass.cpp
Evan Cheng
evan.cheng at apple.com
Wed May 5 15:15:40 PDT 2010
Author: evancheng
Date: Wed May 5 17:15:40 2010
New Revision: 103124
URL: http://llvm.org/viewvc/llvm-project?rev=103124&view=rev
Log:
Do not pre-allocate references of D registers pairs if they are extracted from the same Q register and are in the right order.
Modified:
llvm/trunk/lib/Target/ARM/NEONPreAllocPass.cpp
Modified: llvm/trunk/lib/Target/ARM/NEONPreAllocPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/NEONPreAllocPass.cpp?rev=103124&r1=103123&r2=103124&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/NEONPreAllocPass.cpp (original)
+++ llvm/trunk/lib/Target/ARM/NEONPreAllocPass.cpp Wed May 5 17:15:40 2010
@@ -341,20 +341,40 @@
bool NEONPreAllocPass::FormsRegSequence(MachineInstr *MI,
unsigned FirstOpnd, unsigned NumRegs) {
MachineInstr *RegSeq = 0;
+ unsigned LastSrcReg = 0;
+ unsigned LastSubIdx = 0;
for (unsigned R = 0; R < NumRegs; ++R) {
MachineOperand &MO = MI->getOperand(FirstOpnd + R);
assert(MO.isReg() && MO.getSubReg() == 0 && "unexpected operand");
unsigned VirtReg = MO.getReg();
assert(TargetRegisterInfo::isVirtualRegister(VirtReg) &&
"expected a virtual register");
- if (!MRI->hasOneNonDBGUse(VirtReg))
- return false;
- MachineInstr *UseMI = &*MRI->use_nodbg_begin(VirtReg);
- if (UseMI->getOpcode() != TargetOpcode::REG_SEQUENCE)
- return false;
- if (RegSeq && RegSeq != UseMI)
- return false;
- RegSeq = UseMI;
+ if (MO.isDef()) {
+ // Feeding into a REG_SEQUENCE.
+ if (!MRI->hasOneNonDBGUse(VirtReg))
+ return false;
+ MachineInstr *UseMI = &*MRI->use_nodbg_begin(VirtReg);
+ if (!UseMI->isRegSequence())
+ return false;
+ if (RegSeq && RegSeq != UseMI)
+ return false;
+ RegSeq = UseMI;
+ } else {
+ // Extracting from a Q register.
+ MachineInstr *DefMI = MRI->getVRegDef(VirtReg);
+ if (!DefMI || !DefMI->isExtractSubreg())
+ return false;
+ VirtReg = DefMI->getOperand(1).getReg();
+ if (LastSrcReg && LastSrcReg != VirtReg)
+ return false;
+ const TargetRegisterClass *RC = MRI->getRegClass(VirtReg);
+ if (RC != ARM::QPRRegisterClass)
+ return false;
+ unsigned SubIdx = DefMI->getOperand(2).getImm();
+ if (LastSubIdx && LastSubIdx != SubIdx-1)
+ return false;
+ LastSubIdx = SubIdx;
+ }
}
return true;
}
More information about the llvm-commits
mailing list