mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-12 13:38:21 +00:00
If a register is both an early clobber and part of a tied use, handle the use
before the clobber so that we copy the value if needed. Fixes pr11415. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145056 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -682,7 +682,7 @@ void RAFast::handleThroughOperands(MachineInstr *MI,
|
||||
}
|
||||
|
||||
SmallVector<unsigned, 8> PartialDefs;
|
||||
DEBUG(dbgs() << "Allocating tied uses and early clobbers.\n");
|
||||
DEBUG(dbgs() << "Allocating tied uses.\n");
|
||||
for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
|
||||
MachineOperand &MO = MI->getOperand(i);
|
||||
if (!MO.isReg()) continue;
|
||||
@ -704,15 +704,24 @@ void RAFast::handleThroughOperands(MachineInstr *MI,
|
||||
// That would confuse the later phys-def processing pass.
|
||||
LiveRegMap::iterator LRI = reloadVirtReg(MI, i, Reg, 0);
|
||||
PartialDefs.push_back(LRI->second.PhysReg);
|
||||
} else if (MO.isEarlyClobber()) {
|
||||
// Note: defineVirtReg may invalidate MO.
|
||||
LiveRegMap::iterator LRI = defineVirtReg(MI, i, Reg, 0);
|
||||
unsigned PhysReg = LRI->second.PhysReg;
|
||||
if (setPhysReg(MI, i, PhysReg))
|
||||
VirtDead.push_back(Reg);
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG(dbgs() << "Allocating early clobbers.\n");
|
||||
for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
|
||||
MachineOperand &MO = MI->getOperand(i);
|
||||
if (!MO.isReg()) continue;
|
||||
unsigned Reg = MO.getReg();
|
||||
if (!TargetRegisterInfo::isVirtualRegister(Reg)) continue;
|
||||
if (!MO.isEarlyClobber())
|
||||
continue;
|
||||
// Note: defineVirtReg may invalidate MO.
|
||||
LiveRegMap::iterator LRI = defineVirtReg(MI, i, Reg, 0);
|
||||
unsigned PhysReg = LRI->second.PhysReg;
|
||||
if (setPhysReg(MI, i, PhysReg))
|
||||
VirtDead.push_back(Reg);
|
||||
}
|
||||
|
||||
// Restore UsedInInstr to a state usable for allocating normal virtual uses.
|
||||
UsedInInstr.reset();
|
||||
for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
|
||||
|
Reference in New Issue
Block a user