mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-02 19:24:25 +00:00
Clean up LiveVariables and change how it deals with partial updates and kills. This also eliminate the horrible check which scan forward to the end of the basic block. It should be faster and more accurate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82676 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -268,6 +268,16 @@ bool SimpleRegisterCoalescing::HasOtherReachingDefs(LiveInterval &IntA,
|
||||
return false;
|
||||
}
|
||||
|
||||
static void
|
||||
TransferImplicitOps(MachineInstr *MI, MachineInstr *NewMI) {
|
||||
for (unsigned i = MI->getDesc().getNumOperands(), e = MI->getNumOperands();
|
||||
i != e; ++i) {
|
||||
MachineOperand &MO = MI->getOperand(i);
|
||||
if (MO.isReg() && MO.isImplicit())
|
||||
NewMI->addOperand(MO);
|
||||
}
|
||||
}
|
||||
|
||||
/// RemoveCopyByCommutingDef - We found a non-trivially-coalescable copy with IntA
|
||||
/// being the source and IntB being the dest, thus this defines a value number
|
||||
/// in IntB. If the source value number (in IntA) is defined by a commutable
|
||||
@ -416,7 +426,7 @@ bool SimpleRegisterCoalescing::RemoveCopyByCommutingDef(LiveInterval &IntA,
|
||||
++UI;
|
||||
if (JoinedCopies.count(UseMI))
|
||||
continue;
|
||||
MachineInstrIndex UseIdx = li_->getInstructionIndex(UseMI);
|
||||
MachineInstrIndex UseIdx= li_->getUseIndex(li_->getInstructionIndex(UseMI));
|
||||
LiveInterval::iterator ULR = IntA.FindLiveRangeContaining(UseIdx);
|
||||
if (ULR == IntA.end() || ULR->valno != AValNo)
|
||||
continue;
|
||||
@ -427,7 +437,7 @@ bool SimpleRegisterCoalescing::RemoveCopyByCommutingDef(LiveInterval &IntA,
|
||||
if (Extended)
|
||||
UseMO.setIsKill(false);
|
||||
else
|
||||
BKills.push_back(li_->getNextSlot(li_->getUseIndex(UseIdx)));
|
||||
BKills.push_back(li_->getNextSlot(UseIdx));
|
||||
}
|
||||
unsigned SrcReg, DstReg, SrcSubIdx, DstSubIdx;
|
||||
if (!tii_->isMoveInstr(*UseMI, SrcReg, DstReg, SrcSubIdx, DstSubIdx))
|
||||
@ -724,6 +734,7 @@ bool SimpleRegisterCoalescing::ReMaterializeTrivialDef(LiveInterval &SrcInt,
|
||||
}
|
||||
}
|
||||
|
||||
TransferImplicitOps(CopyMI, NewMI);
|
||||
li_->ReplaceMachineInstrInMaps(CopyMI, NewMI);
|
||||
CopyMI->eraseFromParent();
|
||||
ReMatCopies.insert(CopyMI);
|
||||
|
Reference in New Issue
Block a user