mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-24 08:33:39 +00:00
Fix for PR1266. Don't mark a two address operand IsKill.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35365 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
497b0b0a45
commit
ad7ccf34b5
@ -854,9 +854,9 @@ bool LiveIntervals::AdjustCopiesBackFrom(LiveInterval &IntA, LiveInterval &IntB,
|
|||||||
|
|
||||||
// If the source instruction was killing the source register before the
|
// If the source instruction was killing the source register before the
|
||||||
// merge, unset the isKill marker given the live range has been extended.
|
// merge, unset the isKill marker given the live range has been extended.
|
||||||
MachineOperand *MOK = ValLREndInst->findRegisterUseOperand(IntB.reg, true);
|
int UIdx = ValLREndInst->findRegisterUseOperand(IntB.reg, true);
|
||||||
if (MOK)
|
if (UIdx != -1)
|
||||||
MOK->unsetIsKill();
|
ValLREndInst->getOperand(UIdx).unsetIsKill();
|
||||||
|
|
||||||
// Finally, delete the copy instruction.
|
// Finally, delete the copy instruction.
|
||||||
RemoveMachineInstrFromMaps(CopyMI);
|
RemoveMachineInstrFromMaps(CopyMI);
|
||||||
|
@ -754,10 +754,11 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM,
|
|||||||
// necessary.
|
// necessary.
|
||||||
bool WasKill = false;
|
bool WasKill = false;
|
||||||
if (SSMI) {
|
if (SSMI) {
|
||||||
MachineOperand *MOK = SSMI->findRegisterUseOperand(PhysReg, true);
|
int UIdx = SSMI->findRegisterUseOperand(PhysReg, true);
|
||||||
if (MOK) {
|
if (UIdx != -1) {
|
||||||
WasKill = MOK->isKill();
|
MachineOperand &MOK = SSMI->getOperand(UIdx);
|
||||||
MOK->unsetIsKill();
|
WasKill = MOK.isKill();
|
||||||
|
MOK.unsetIsKill();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ti == -1) {
|
if (ti == -1) {
|
||||||
@ -840,17 +841,20 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM,
|
|||||||
// necessary.
|
// necessary.
|
||||||
bool WasKill = false;
|
bool WasKill = false;
|
||||||
if (SSMI) {
|
if (SSMI) {
|
||||||
MachineOperand *MOK = SSMI->findRegisterUseOperand(PhysReg, true);
|
int UIdx = SSMI->findRegisterUseOperand(PhysReg, true);
|
||||||
if (MOK) {
|
if (UIdx != -1) {
|
||||||
WasKill = MOK->isKill();
|
MachineOperand &MOK = SSMI->getOperand(UIdx);
|
||||||
MOK->unsetIsKill();
|
WasKill = MOK.isKill();
|
||||||
|
MOK.unsetIsKill();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MachineInstr *CopyMI = prior(MII);
|
MachineInstr *CopyMI = prior(MII);
|
||||||
if (WasKill) {
|
if (WasKill) {
|
||||||
// Transfer kill to the next use.
|
// Transfer kill to the next use.
|
||||||
MachineOperand *MOU = CopyMI->findRegisterUseOperand(PhysReg);
|
int UIdx = CopyMI->findRegisterUseOperand(PhysReg);
|
||||||
MOU->setIsKill();
|
assert(UIdx != -1);
|
||||||
|
MachineOperand &MOU = CopyMI->getOperand(UIdx);
|
||||||
|
MOU.setIsKill();
|
||||||
}
|
}
|
||||||
Spills.addLastUse(PhysReg, CopyMI);
|
Spills.addLastUse(PhysReg, CopyMI);
|
||||||
|
|
||||||
@ -945,18 +949,25 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM,
|
|||||||
// extended. Remove its kill.
|
// extended. Remove its kill.
|
||||||
bool WasKill = false;
|
bool WasKill = false;
|
||||||
if (SSMI) {
|
if (SSMI) {
|
||||||
MachineOperand *MOK = SSMI->findRegisterUseOperand(InReg, true);
|
int UIdx = SSMI->findRegisterUseOperand(InReg, true);
|
||||||
if (MOK) {
|
if (UIdx != -1) {
|
||||||
WasKill = MOK->isKill();
|
MachineOperand &MOK = SSMI->getOperand(UIdx);
|
||||||
MOK->unsetIsKill();
|
WasKill = MOK.isKill();
|
||||||
|
MOK.unsetIsKill();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (NextMII != MBB.end()) {
|
if (NextMII != MBB.end()) {
|
||||||
// If NextMII uses InReg (must be the copy?), mark it killed.
|
// If NextMII uses InReg and the use is not a two address
|
||||||
MachineOperand *MOU = NextMII->findRegisterUseOperand(InReg);
|
// operand, mark it killed.
|
||||||
if (MOU) {
|
int UIdx = NextMII->findRegisterUseOperand(InReg);
|
||||||
if (WasKill)
|
if (UIdx != -1) {
|
||||||
MOU->setIsKill();
|
MachineOperand &MOU = NextMII->getOperand(UIdx);
|
||||||
|
if (WasKill) {
|
||||||
|
const TargetInstrDescriptor *NTID =
|
||||||
|
NextMII->getInstrDescriptor();
|
||||||
|
if (NTID->getOperandConstraint(UIdx, TOI::TIED_TO) == -1)
|
||||||
|
MOU.setIsKill();
|
||||||
|
}
|
||||||
Spills.addLastUse(InReg, &(*NextMII));
|
Spills.addLastUse(InReg, &(*NextMII));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user