mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-23 01:24:30 +00:00
Remove physreg support from adjustCopiesBackFrom and removeCopyByCommutingDef.
After physreg coalescing was disabled, these functions can't do anything useful with physregs anyway. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157849 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -396,6 +396,7 @@ void RegisterCoalescer::LRE_WillEraseInstruction(MachineInstr *MI) {
|
|||||||
bool RegisterCoalescer::adjustCopiesBackFrom(const CoalescerPair &CP,
|
bool RegisterCoalescer::adjustCopiesBackFrom(const CoalescerPair &CP,
|
||||||
MachineInstr *CopyMI) {
|
MachineInstr *CopyMI) {
|
||||||
assert(!CP.isPartial() && "This doesn't work for partial copies.");
|
assert(!CP.isPartial() && "This doesn't work for partial copies.");
|
||||||
|
assert(!CP.isPhys() && "This doesn't work for physreg copies.");
|
||||||
|
|
||||||
// Bail if there is no dst interval - can happen when merging physical subreg
|
// Bail if there is no dst interval - can happen when merging physical subreg
|
||||||
// operations.
|
// operations.
|
||||||
@ -450,20 +451,6 @@ bool RegisterCoalescer::adjustCopiesBackFrom(const CoalescerPair &CP,
|
|||||||
// IntB, we can merge them.
|
// IntB, we can merge them.
|
||||||
if (ValLR+1 != BLR) return false;
|
if (ValLR+1 != BLR) return false;
|
||||||
|
|
||||||
// If a live interval is a physical register, conservatively check if any
|
|
||||||
// of its aliases is overlapping the live interval of the virtual register.
|
|
||||||
// If so, do not coalesce.
|
|
||||||
if (TargetRegisterInfo::isPhysicalRegister(IntB.reg)) {
|
|
||||||
for (const uint16_t *AS = TRI->getAliasSet(IntB.reg); *AS; ++AS)
|
|
||||||
if (LIS->hasInterval(*AS) && IntA.overlaps(LIS->getInterval(*AS))) {
|
|
||||||
DEBUG({
|
|
||||||
dbgs() << "\t\tInterfere with alias ";
|
|
||||||
LIS->getInterval(*AS).print(dbgs(), TRI);
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DEBUG({
|
DEBUG({
|
||||||
dbgs() << "Extending: ";
|
dbgs() << "Extending: ";
|
||||||
IntB.print(dbgs(), TRI);
|
IntB.print(dbgs(), TRI);
|
||||||
@ -576,12 +563,7 @@ bool RegisterCoalescer::hasOtherReachingDefs(LiveInterval &IntA,
|
|||||||
///
|
///
|
||||||
bool RegisterCoalescer::removeCopyByCommutingDef(const CoalescerPair &CP,
|
bool RegisterCoalescer::removeCopyByCommutingDef(const CoalescerPair &CP,
|
||||||
MachineInstr *CopyMI) {
|
MachineInstr *CopyMI) {
|
||||||
// FIXME: For now, only eliminate the copy by commuting its def when the
|
assert (!CP.isPhys());
|
||||||
// source register is a virtual register. We want to guard against cases
|
|
||||||
// where the copy is a back edge copy and commuting the def lengthen the
|
|
||||||
// live interval of the source register to the entire loop.
|
|
||||||
if (CP.isPhys() && CP.isFlipped())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Bail if there is no dst interval.
|
// Bail if there is no dst interval.
|
||||||
if (!LIS->hasInterval(CP.getDstReg()))
|
if (!LIS->hasInterval(CP.getDstReg()))
|
||||||
@ -642,14 +624,6 @@ bool RegisterCoalescer::removeCopyByCommutingDef(const CoalescerPair &CP,
|
|||||||
if (hasOtherReachingDefs(IntA, IntB, AValNo, BValNo))
|
if (hasOtherReachingDefs(IntA, IntB, AValNo, BValNo))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Abort if the aliases of IntB.reg have values that are not simply the
|
|
||||||
// clobbers from the superreg.
|
|
||||||
if (TargetRegisterInfo::isPhysicalRegister(IntB.reg))
|
|
||||||
for (const uint16_t *AS = TRI->getAliasSet(IntB.reg); *AS; ++AS)
|
|
||||||
if (LIS->hasInterval(*AS) &&
|
|
||||||
hasOtherReachingDefs(IntA, LIS->getInterval(*AS), AValNo, 0))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// If some of the uses of IntA.reg is already coalesced away, return false.
|
// If some of the uses of IntA.reg is already coalesced away, return false.
|
||||||
// It's not possible to determine whether it's safe to perform the coalescing.
|
// It's not possible to determine whether it's safe to perform the coalescing.
|
||||||
for (MachineRegisterInfo::use_nodbg_iterator UI =
|
for (MachineRegisterInfo::use_nodbg_iterator UI =
|
||||||
@ -1064,7 +1038,7 @@ bool RegisterCoalescer::joinCopy(MachineInstr *CopyMI, bool &Again) {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
// If we can eliminate the copy without merging the live ranges, do so now.
|
// If we can eliminate the copy without merging the live ranges, do so now.
|
||||||
if (!CP.isPartial()) {
|
if (!CP.isPartial() && !CP.isPhys()) {
|
||||||
if (adjustCopiesBackFrom(CP, CopyMI) ||
|
if (adjustCopiesBackFrom(CP, CopyMI) ||
|
||||||
removeCopyByCommutingDef(CP, CopyMI)) {
|
removeCopyByCommutingDef(CP, CopyMI)) {
|
||||||
LIS->RemoveMachineInstrFromMaps(CopyMI);
|
LIS->RemoveMachineInstrFromMaps(CopyMI);
|
||||||
|
Reference in New Issue
Block a user