[Live Intervals] Factor-out unionBitMask. NFC.

For further re-usage in other place.
This commit is contained in:
Serguei Katkov 2021-04-14 10:37:54 +07:00
parent accb095512
commit d5ed0d4816
1 changed files with 10 additions and 6 deletions

View File

@ -914,11 +914,8 @@ bool LiveIntervals::checkRegMaskInterference(LiveInterval &LI,
return false;
bool Found = false;
while (true) {
assert(*SlotI >= LiveI->start);
// Loop over all slots overlapping this segment.
while (*SlotI < LiveI->end) {
// *SlotI overlaps LI. Collect mask bits.
// Utility to union regmasks.
auto unionBitMask = [&](unsigned Idx) {
if (!Found) {
// This is the first overlap. Initialize UsableRegs to all ones.
UsableRegs.clear();
@ -926,7 +923,14 @@ bool LiveIntervals::checkRegMaskInterference(LiveInterval &LI,
Found = true;
}
// Remove usable registers clobbered by this mask.
UsableRegs.clearBitsNotInMask(Bits[SlotI-Slots.begin()]);
UsableRegs.clearBitsNotInMask(Bits[Idx]);
};
while (true) {
assert(*SlotI >= LiveI->start);
// Loop over all slots overlapping this segment.
while (*SlotI < LiveI->end) {
// *SlotI overlaps LI. Collect mask bits.
unionBitMask(SlotI - Slots.begin());
if (++SlotI == SlotE)
return Found;
}