mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-29 22:52:18 +00:00
Add regunit liveness support to LiveIntervals::handleMove().
When LiveIntervals is tracking fixed interference in regunits, make sure to update those intervals as well. Currently guarded by -live-regunits. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158766 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6e9a757d65
commit
bf833f0747
@ -1193,36 +1193,34 @@ private:
|
||||
// TODO: Currently we're skipping uses that are reserved or have no
|
||||
// interval, but we're not updating their kills. This should be
|
||||
// fixed.
|
||||
if (!LIS.hasInterval(Reg) ||
|
||||
(TargetRegisterInfo::isPhysicalRegister(Reg) && LIS.isReserved(Reg)))
|
||||
if (TargetRegisterInfo::isPhysicalRegister(Reg) && LIS.isReserved(Reg))
|
||||
continue;
|
||||
|
||||
LiveInterval* LI = &LIS.getInterval(Reg);
|
||||
if (TargetRegisterInfo::isPhysicalRegister(Reg) && LIS.trackingRegUnits())
|
||||
for (MCRegUnitIterator Units(Reg, &TRI); Units.isValid(); ++Units)
|
||||
collectRanges(MO, &LIS.getRegUnit(*Units),
|
||||
Entering, Internal, Exiting, OldIdx);
|
||||
else if (LIS.hasInterval(Reg))
|
||||
collectRanges(MO, &LIS.getInterval(Reg),
|
||||
Entering, Internal, Exiting, OldIdx);
|
||||
}
|
||||
}
|
||||
|
||||
if (MO.readsReg()) {
|
||||
LiveRange* LR = LI->getLiveRangeContaining(OldIdx);
|
||||
if (LR != 0)
|
||||
Entering.insert(std::make_pair(LI, LR));
|
||||
}
|
||||
if (MO.isDef()) {
|
||||
if (MO.isEarlyClobber()) {
|
||||
LiveRange* LR = LI->getLiveRangeContaining(OldIdx.getRegSlot(true));
|
||||
assert(LR != 0 && "No EC range?");
|
||||
if (LR->end > OldIdx.getDeadSlot())
|
||||
Exiting.insert(std::make_pair(LI, LR));
|
||||
else
|
||||
Internal.insert(std::make_pair(LI, LR));
|
||||
} else if (MO.isDead()) {
|
||||
LiveRange* LR = LI->getLiveRangeContaining(OldIdx.getRegSlot());
|
||||
assert(LR != 0 && "No dead-def range?");
|
||||
Internal.insert(std::make_pair(LI, LR));
|
||||
} else {
|
||||
LiveRange* LR = LI->getLiveRangeContaining(OldIdx.getDeadSlot());
|
||||
assert(LR && LR->end > OldIdx.getDeadSlot() &&
|
||||
"Non-dead-def should have live range exiting.");
|
||||
Exiting.insert(std::make_pair(LI, LR));
|
||||
}
|
||||
}
|
||||
void collectRanges(const MachineOperand &MO, LiveInterval *LI,
|
||||
RangeSet &Entering, RangeSet &Internal, RangeSet &Exiting,
|
||||
SlotIndex OldIdx) {
|
||||
if (MO.readsReg()) {
|
||||
LiveRange* LR = LI->getLiveRangeContaining(OldIdx);
|
||||
if (LR != 0)
|
||||
Entering.insert(std::make_pair(LI, LR));
|
||||
}
|
||||
if (MO.isDef()) {
|
||||
LiveRange* LR = LI->getLiveRangeContaining(OldIdx.getRegSlot());
|
||||
assert(LR != 0 && "No live range for def?");
|
||||
if (LR->end > OldIdx.getDeadSlot())
|
||||
Exiting.insert(std::make_pair(LI, LR));
|
||||
else
|
||||
Internal.insert(std::make_pair(LI, LR));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1243,25 +1241,34 @@ private:
|
||||
// TODO: Currently we're skipping uses that are reserved or have no
|
||||
// interval, but we're not updating their kills. This should be
|
||||
// fixed.
|
||||
if (!LIS.hasInterval(Reg) ||
|
||||
(TargetRegisterInfo::isPhysicalRegister(Reg) && LIS.isReserved(Reg)))
|
||||
if (TargetRegisterInfo::isPhysicalRegister(Reg) && LIS.isReserved(Reg))
|
||||
continue;
|
||||
|
||||
LiveInterval* LI = &LIS.getInterval(Reg);
|
||||
if (TargetRegisterInfo::isPhysicalRegister(Reg) && LIS.trackingRegUnits())
|
||||
for (MCRegUnitIterator Units(Reg, &TRI); Units.isValid(); ++Units)
|
||||
collectRangesInBundle(MO, &LIS.getRegUnit(*Units),
|
||||
Entering, Exiting, MIStartIdx, MIEndIdx);
|
||||
else if (LIS.hasInterval(Reg))
|
||||
collectRangesInBundle(MO, &LIS.getInterval(Reg),
|
||||
Entering, Exiting, MIStartIdx, MIEndIdx);
|
||||
}
|
||||
}
|
||||
|
||||
if (MO.readsReg()) {
|
||||
LiveRange* LR = LI->getLiveRangeContaining(MIStartIdx);
|
||||
if (LR != 0)
|
||||
Entering.insert(std::make_pair(LI, LR));
|
||||
}
|
||||
if (MO.isDef()) {
|
||||
assert(!MO.isEarlyClobber() &&
|
||||
"Early clobbers not allowed in bundles.");
|
||||
assert(!MO.isDead() && "Dead-defs not allowed in bundles.");
|
||||
LiveRange* LR = LI->getLiveRangeContaining(MIEndIdx.getDeadSlot());
|
||||
assert(LR != 0 && "Internal ranges not allowed in bundles.");
|
||||
Exiting.insert(std::make_pair(LI, LR));
|
||||
}
|
||||
void collectRangesInBundle(const MachineOperand &MO, LiveInterval *LI,
|
||||
RangeSet &Entering, RangeSet &Exiting,
|
||||
SlotIndex MIStartIdx, SlotIndex MIEndIdx) {
|
||||
if (MO.readsReg()) {
|
||||
LiveRange* LR = LI->getLiveRangeContaining(MIStartIdx);
|
||||
if (LR != 0)
|
||||
Entering.insert(std::make_pair(LI, LR));
|
||||
}
|
||||
if (MO.isDef()) {
|
||||
assert(!MO.isEarlyClobber() &&
|
||||
"Early clobbers not allowed in bundles.");
|
||||
assert(!MO.isDead() && "Dead-defs not allowed in bundles.");
|
||||
LiveRange* LR = LI->getLiveRangeContaining(MIEndIdx.getDeadSlot());
|
||||
assert(LR != 0 && "Internal ranges not allowed in bundles.");
|
||||
Exiting.insert(std::make_pair(LI, LR));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user