mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-12 13:30:51 +00:00
LiveInterval: Document and enforce rules about empty subranges.
Empty subranges are not allowed in a LiveInterval and must be removed instead: Check this in the verifiers, put a reminder for this in the comment of the shrinkToUses variant for a single lane and make it automatic for the shrinkToUses variant for a LiveInterval. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242431 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ac40c926aa
commit
0219a272ec
@ -160,6 +160,8 @@ extern cl::opt<bool> UseSegmentSetForPhysRegs;
|
|||||||
/// shrinkToUses(LiveInterval *li, SmallVectorImpl<MachineInstr*> *dead)
|
/// shrinkToUses(LiveInterval *li, SmallVectorImpl<MachineInstr*> *dead)
|
||||||
/// that works on a subregister live range and only looks at uses matching
|
/// that works on a subregister live range and only looks at uses matching
|
||||||
/// the lane mask of the subregister range.
|
/// the lane mask of the subregister range.
|
||||||
|
/// This may leave the subrange empty which needs to be cleaned up with
|
||||||
|
/// LiveInterval::removeEmptySubranges() afterwards.
|
||||||
void shrinkToUses(LiveInterval::SubRange &SR, unsigned Reg);
|
void shrinkToUses(LiveInterval::SubRange &SR, unsigned Reg);
|
||||||
|
|
||||||
/// extendToIndices - Extend the live range of LI to reach all points in
|
/// extendToIndices - Extend the live range of LI to reach all points in
|
||||||
|
@ -1110,6 +1110,8 @@ void LiveInterval::verify(const MachineRegisterInfo *MRI) const {
|
|||||||
|
|
||||||
// subrange mask should not contained in maximum lane mask for the vreg.
|
// subrange mask should not contained in maximum lane mask for the vreg.
|
||||||
assert((Mask & ~MaxMask) == 0);
|
assert((Mask & ~MaxMask) == 0);
|
||||||
|
// empty subranges must be removed.
|
||||||
|
assert(!SR.empty());
|
||||||
|
|
||||||
SR.verify();
|
SR.verify();
|
||||||
// Main liverange should cover subrange.
|
// Main liverange should cover subrange.
|
||||||
|
@ -403,9 +403,14 @@ bool LiveIntervals::shrinkToUses(LiveInterval *li,
|
|||||||
&& "Can only shrink virtual registers");
|
&& "Can only shrink virtual registers");
|
||||||
|
|
||||||
// Shrink subregister live ranges.
|
// Shrink subregister live ranges.
|
||||||
|
bool NeedsCleanup = false;
|
||||||
for (LiveInterval::SubRange &S : li->subranges()) {
|
for (LiveInterval::SubRange &S : li->subranges()) {
|
||||||
shrinkToUses(S, li->reg);
|
shrinkToUses(S, li->reg);
|
||||||
|
if (S.empty())
|
||||||
|
NeedsCleanup = true;
|
||||||
}
|
}
|
||||||
|
if (NeedsCleanup)
|
||||||
|
li->removeEmptySubRanges();
|
||||||
|
|
||||||
// Find all the values used, including PHI kills.
|
// Find all the values used, including PHI kills.
|
||||||
ShrinkToUsesWorkList WorkList;
|
ShrinkToUsesWorkList WorkList;
|
||||||
|
@ -1671,6 +1671,8 @@ void MachineVerifier::verifyLiveInterval(const LiveInterval &LI) {
|
|||||||
report("Lane masks of sub ranges overlap in live interval", MF, LI);
|
report("Lane masks of sub ranges overlap in live interval", MF, LI);
|
||||||
if ((SR.LaneMask & ~MaxMask) != 0)
|
if ((SR.LaneMask & ~MaxMask) != 0)
|
||||||
report("Subrange lanemask is invalid", MF, LI);
|
report("Subrange lanemask is invalid", MF, LI);
|
||||||
|
if (SR.empty())
|
||||||
|
report("Subrange must not be empty", MF, SR, LI.reg, SR.LaneMask);
|
||||||
Mask |= SR.LaneMask;
|
Mask |= SR.LaneMask;
|
||||||
verifyLiveRange(SR, LI.reg, SR.LaneMask);
|
verifyLiveRange(SR, LI.reg, SR.LaneMask);
|
||||||
if (!LI.covers(SR))
|
if (!LI.covers(SR))
|
||||||
|
Loading…
Reference in New Issue
Block a user