mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-05 12:31:33 +00:00
Do not pre-allocate references of D registers pairs if they are extracted from the same Q register and are in the right order.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103124 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bc1c98d538
commit
676b2dfd27
@ -341,20 +341,40 @@ static bool isNEONMultiRegOp(int Opcode, unsigned &FirstOpnd, unsigned &NumRegs,
|
|||||||
bool NEONPreAllocPass::FormsRegSequence(MachineInstr *MI,
|
bool NEONPreAllocPass::FormsRegSequence(MachineInstr *MI,
|
||||||
unsigned FirstOpnd, unsigned NumRegs) {
|
unsigned FirstOpnd, unsigned NumRegs) {
|
||||||
MachineInstr *RegSeq = 0;
|
MachineInstr *RegSeq = 0;
|
||||||
|
unsigned LastSrcReg = 0;
|
||||||
|
unsigned LastSubIdx = 0;
|
||||||
for (unsigned R = 0; R < NumRegs; ++R) {
|
for (unsigned R = 0; R < NumRegs; ++R) {
|
||||||
MachineOperand &MO = MI->getOperand(FirstOpnd + R);
|
MachineOperand &MO = MI->getOperand(FirstOpnd + R);
|
||||||
assert(MO.isReg() && MO.getSubReg() == 0 && "unexpected operand");
|
assert(MO.isReg() && MO.getSubReg() == 0 && "unexpected operand");
|
||||||
unsigned VirtReg = MO.getReg();
|
unsigned VirtReg = MO.getReg();
|
||||||
assert(TargetRegisterInfo::isVirtualRegister(VirtReg) &&
|
assert(TargetRegisterInfo::isVirtualRegister(VirtReg) &&
|
||||||
"expected a virtual register");
|
"expected a virtual register");
|
||||||
if (!MRI->hasOneNonDBGUse(VirtReg))
|
if (MO.isDef()) {
|
||||||
return false;
|
// Feeding into a REG_SEQUENCE.
|
||||||
MachineInstr *UseMI = &*MRI->use_nodbg_begin(VirtReg);
|
if (!MRI->hasOneNonDBGUse(VirtReg))
|
||||||
if (UseMI->getOpcode() != TargetOpcode::REG_SEQUENCE)
|
return false;
|
||||||
return false;
|
MachineInstr *UseMI = &*MRI->use_nodbg_begin(VirtReg);
|
||||||
if (RegSeq && RegSeq != UseMI)
|
if (!UseMI->isRegSequence())
|
||||||
return false;
|
return false;
|
||||||
RegSeq = UseMI;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user