// Interference for the live-in value.
if (BI.LiveIn) {
- if (Intf.first() <= BI.Start)
+ if (Intf.first() <= Indexes->getMBBStartIdx(BC.Number))
BC.Entry = SpillPlacement::MustSpill, Ins += BI.Uses;
else if (!BI.Uses)
BC.Entry = SpillPlacement::PrefSpill;
if (!BI.LiveOut || !RegOut)
continue;
+ SlotIndex Start, Stop;
+ tie(Start, Stop) = Indexes->getMBBRange(BI.MBB);
Intf.moveToBlock(BI.MBB->getNumber());
DEBUG(dbgs() << "BB#" << BI.MBB->getNumber() << " -> EB#"
<< Bundles->getBundle(BI.MBB->getNumber(), 1)
- << " [" << BI.Start << ';' << BI.LastSplitPoint << '-'
- << BI.Stop << ") intf [" << Intf.first() << ';' << Intf.last()
+ << " [" << Start << ';' << BI.LastSplitPoint << '-'
+ << Stop << ") intf [" << Intf.first() << ';' << Intf.last()
<< ')');
// The interference interval should either be invalid or overlap MBB.
- assert((!Intf.hasInterference() || Intf.first() < BI.Stop)
+ assert((!Intf.hasInterference() || Intf.first() < Stop)
&& "Bad interference");
- assert((!Intf.hasInterference() || Intf.last() > BI.Start)
+ assert((!Intf.hasInterference() || Intf.last() > Start)
&& "Bad interference");
// Check interference leaving the block.
}
if (!BI.LiveThrough) {
DEBUG(dbgs() << ", not live-through.\n");
- SE->useIntv(SE->enterIntvBefore(BI.Def), BI.Stop);
+ SE->useIntv(SE->enterIntvBefore(BI.Def), Stop);
continue;
}
if (!RegIn) {
// Block is live-through, but entry bundle is on the stack.
// Reload just before the first use.
DEBUG(dbgs() << ", not live-in, enter before first use.\n");
- SE->useIntv(SE->enterIntvBefore(BI.FirstUse), BI.Stop);
+ SE->useIntv(SE->enterIntvBefore(BI.FirstUse), Stop);
continue;
}
DEBUG(dbgs() << ", live-through.\n");
if (!BI.LiveThrough && Intf.last() <= BI.Def) {
// The interference doesn't reach the outgoing segment.
DEBUG(dbgs() << " doesn't affect def from " << BI.Def << '\n');
- SE->useIntv(BI.Def, BI.Stop);
+ SE->useIntv(BI.Def, Stop);
continue;
}
SlotIndex SegStart = SE->enterIntvBefore(Use);
assert(SegStart >= Intf.last() && "Couldn't avoid interference");
assert(SegStart < BI.LastSplitPoint && "Impossible split point");
- SE->useIntv(SegStart, BI.Stop);
+ SE->useIntv(SegStart, Stop);
continue;
}
}
continue;
// We have an incoming register. Check for interference.
+ SlotIndex Start, Stop;
+ tie(Start, Stop) = Indexes->getMBBRange(BI.MBB);
Intf.moveToBlock(BI.MBB->getNumber());
DEBUG(dbgs() << "EB#" << Bundles->getBundle(BI.MBB->getNumber(), 0)
- << " -> BB#" << BI.MBB->getNumber() << " [" << BI.Start << ';'
- << BI.LastSplitPoint << '-' << BI.Stop << ')');
+ << " -> BB#" << BI.MBB->getNumber() << " [" << Start << ';'
+ << BI.LastSplitPoint << '-' << Stop << ')');
// Check interference entering the block.
if (!Intf.hasInterference()) {
// Block is live-through without interference.
if (RegOut) {
DEBUG(dbgs() << ", no uses, live-through.\n");
- SE->useIntv(BI.Start, BI.Stop);
+ SE->useIntv(Start, Stop);
} else {
DEBUG(dbgs() << ", no uses, stack-out.\n");
SE->leaveIntvAtTop(*BI.MBB);
}
if (!BI.LiveThrough) {
DEBUG(dbgs() << ", killed in block.\n");
- SE->useIntv(BI.Start, SE->leaveIntvAfter(BI.Kill));
+ SE->useIntv(Start, SE->leaveIntvAfter(BI.Kill));
continue;
}
if (!RegOut) {
// Spill immediately after the last use.
if (BI.LastUse < BI.LastSplitPoint) {
DEBUG(dbgs() << ", uses, stack-out.\n");
- SE->useIntv(BI.Start, SE->leaveIntvAfter(BI.LastUse));
+ SE->useIntv(Start, SE->leaveIntvAfter(BI.LastUse));
continue;
}
// The last use is after the last split point, it is probably an
DEBUG(dbgs() << ", uses at " << BI.LastUse << " after split point "
<< BI.LastSplitPoint << ", stack-out.\n");
SlotIndex SegEnd = SE->leaveIntvBefore(BI.LastSplitPoint);
- SE->useIntv(BI.Start, SegEnd);
+ SE->useIntv(Start, SegEnd);
// Run a double interval from the split to the last use.
// This makes it possible to spill the complement without affecting the
// indirect branch.
}
// Register is live-through.
DEBUG(dbgs() << ", uses, live-through.\n");
- SE->useIntv(BI.Start, BI.Stop);
+ SE->useIntv(Start, Stop);
continue;
}
if (!BI.LiveThrough && Intf.first() >= BI.Kill) {
// The interference doesn't reach the outgoing segment.
DEBUG(dbgs() << " doesn't affect kill at " << BI.Kill << '\n');
- SE->useIntv(BI.Start, BI.Kill);
+ SE->useIntv(Start, BI.Kill);
continue;
}
DEBUG(dbgs() << ", free use at " << *UI << ".\n");
SlotIndex SegEnd = SE->leaveIntvAfter(Use);
assert(SegEnd <= Intf.first() && "Couldn't avoid interference");
- SE->useIntv(BI.Start, SegEnd);
+ SE->useIntv(Start, SegEnd);
continue;
}
for (;;) {
BlockInfo BI;
BI.MBB = MFI;
- tie(BI.Start, BI.Stop) = LIS.getSlotIndexes()->getMBBRange(BI.MBB);
+ SlotIndex Start, Stop;
+ tie(Start, Stop) = LIS.getSlotIndexes()->getMBBRange(BI.MBB);
// The last split point is the latest possible insertion point that dominates
// all successor blocks. If interference reaches LastSplitPoint, it is not
// outgoing bundle.
MachineBasicBlock::iterator LSP = LIS.getLastSplitPoint(*CurLI, BI.MBB);
if (LSP == BI.MBB->end())
- BI.LastSplitPoint = BI.Stop;
+ BI.LastSplitPoint = Stop;
else
BI.LastSplitPoint = LIS.getInstructionIndex(LSP);
// LVI is the first live segment overlapping MBB.
- BI.LiveIn = LVI->start <= BI.Start;
+ BI.LiveIn = LVI->start <= Start;
if (!BI.LiveIn)
BI.Def = LVI->start;
BI.Uses = hasUses(MFI);
if (BI.Uses && UseI != UseE) {
BI.FirstUse = *UseI;
- assert(BI.FirstUse >= BI.Start);
+ assert(BI.FirstUse >= Start);
do ++UseI;
- while (UseI != UseE && *UseI < BI.Stop);
+ while (UseI != UseE && *UseI < Stop);
BI.LastUse = UseI[-1];
- assert(BI.LastUse < BI.Stop);
+ assert(BI.LastUse < Stop);
}
// Look for gaps in the live range.
bool hasGap = false;
BI.LiveOut = true;
- while (LVI->end < BI.Stop) {
+ while (LVI->end < Stop) {
SlotIndex LastStop = LVI->end;
- if (++LVI == LVE || LVI->start >= BI.Stop) {
+ if (++LVI == LVE || LVI->start >= Stop) {
BI.Kill = LastStop;
BI.LiveOut = false;
break;
break;
// Live segment ends exactly at Stop. Move to the next segment.
- if (LVI->end == BI.Stop && ++LVI == LVE)
+ if (LVI->end == Stop && ++LVI == LVE)
break;
// Pick the next basic block.
- if (LVI->start < BI.Stop)
+ if (LVI->start < Stop)
++MFI;
else
MFI = LIS.getMBBFromIndex(LVI->start);