mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-29 10:25:12 +00:00
LiveRangeCalc: Rewrite subrange calculation
This changes subrange calculation to calculate subranges sequentially instead of in parallel. The code is easier to understand that way and addresses the code review issues raised about LiveOutData being hard to understand/needing more comments by removing them :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224272 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -192,8 +192,7 @@ void LiveIntervals::computeVirtRegInterval(LiveInterval &LI) {
|
||||
assert(LRCalc && "LRCalc not initialized.");
|
||||
assert(LI.empty() && "Should only compute empty intervals.");
|
||||
LRCalc->reset(MF, getSlotIndexes(), DomTree, &getVNInfoAllocator());
|
||||
LRCalc->createDeadDefs(LI);
|
||||
LRCalc->extendToUses(LI);
|
||||
LRCalc->calculate(LI);
|
||||
computeDeadValues(LI, LI);
|
||||
}
|
||||
|
||||
@@ -251,22 +250,15 @@ void LiveIntervals::computeRegUnitRange(LiveRange &LR, unsigned Unit) {
|
||||
// may share super-registers. That's OK because createDeadDefs() is
|
||||
// idempotent. It is very rare for a register unit to have multiple roots, so
|
||||
// uniquing super-registers is probably not worthwhile.
|
||||
for (MCRegUnitRootIterator Roots(Unit, TRI); Roots.isValid(); ++Roots) {
|
||||
for (MCSuperRegIterator Supers(*Roots, TRI, /*IncludeSelf=*/true);
|
||||
Supers.isValid(); ++Supers) {
|
||||
if (!MRI->reg_empty(*Supers))
|
||||
LRCalc->createDeadDefs(LR, *Supers);
|
||||
}
|
||||
}
|
||||
|
||||
// Now extend LR to reach all uses.
|
||||
// Ignore uses of reserved registers. We only track defs of those.
|
||||
for (MCRegUnitRootIterator Roots(Unit, TRI); Roots.isValid(); ++Roots) {
|
||||
for (MCSuperRegIterator Supers(*Roots, TRI, /*IncludeSelf=*/true);
|
||||
Supers.isValid(); ++Supers) {
|
||||
unsigned Reg = *Supers;
|
||||
if (!MRI->isReserved(Reg) && !MRI->reg_empty(Reg))
|
||||
LRCalc->extendToUses(LR, Reg);
|
||||
if (MRI->reg_empty(Reg))
|
||||
continue;
|
||||
// Ignore uses of reserved registers. We only track defs of those.
|
||||
bool IgnoreUses = MRI->isReserved(Reg);
|
||||
LRCalc->calculate(LR, *Supers, IgnoreUses);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user