mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-09 01:38:03 +00:00
Use a separate LiveRangeCalc for the complement in spill modes.
The complement interval may overlap the other intervals created, so use a separate LiveRangeCalc instance to compute its live range. A LiveRangeCalc instance can only be shared among non-overlapping intervals. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139603 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
de9ddbf19a
commit
c1c622ef0d
lib/CodeGen
@ -319,7 +319,11 @@ void SplitEditor::reset(LiveRangeEdit &LRE, ComplementSpillMode SM) {
|
||||
OpenIdx = 0;
|
||||
RegAssign.clear();
|
||||
Values.clear();
|
||||
LRCalc.reset(&VRM.getMachineFunction());
|
||||
|
||||
// Reset the LiveRangeCalc instances needed for this spill mode.
|
||||
LRCalc[0].reset(&VRM.getMachineFunction());
|
||||
if (SpillMode)
|
||||
LRCalc[1].reset(&VRM.getMachineFunction());
|
||||
|
||||
// We don't need an AliasAnalysis since we will only be performing
|
||||
// cheap-as-a-copy remats anyway.
|
||||
@ -390,8 +394,8 @@ void SplitEditor::markComplexMapped(unsigned RegIdx, const VNInfo *ParentVNI) {
|
||||
// extendRange - Extend the live range to reach Idx.
|
||||
// Potentially create phi-def values.
|
||||
void SplitEditor::extendRange(unsigned RegIdx, SlotIndex Idx) {
|
||||
LRCalc.extend(Edit->get(RegIdx), Idx.getNextSlot(),
|
||||
LIS.getSlotIndexes(), &MDT, &LIS.getVNInfoAllocator());
|
||||
getLRCalc(RegIdx).extend(Edit->get(RegIdx), Idx.getNextSlot(),
|
||||
LIS.getSlotIndexes(), &MDT, &LIS.getVNInfoAllocator());
|
||||
}
|
||||
|
||||
VNInfo *SplitEditor::defFromParent(unsigned RegIdx,
|
||||
@ -633,6 +637,8 @@ bool SplitEditor::transferValues() {
|
||||
continue;
|
||||
}
|
||||
|
||||
LiveRangeCalc &LRC = getLRCalc(RegIdx);
|
||||
|
||||
// This value has multiple defs in RegIdx, but it wasn't rematerialized,
|
||||
// so the live range is accurate. Add live-in blocks in [Start;End) to the
|
||||
// LiveInBlocks.
|
||||
@ -648,7 +654,7 @@ bool SplitEditor::transferValues() {
|
||||
DEBUG(dbgs() << ':' << VNI->id << "*BB#" << MBB->getNumber());
|
||||
// MBB has its own def. Is it also live-out?
|
||||
if (BlockEnd <= End)
|
||||
LRCalc.setLiveOutValue(MBB, VNI);
|
||||
LRC.setLiveOutValue(MBB, VNI);
|
||||
|
||||
// Skip to the next block for live-in.
|
||||
++MBB;
|
||||
@ -667,16 +673,16 @@ bool SplitEditor::transferValues() {
|
||||
std::min(BlockEnd, End).getPrevSlot());
|
||||
assert(VNI && "Missing def for complex mapped parent PHI");
|
||||
if (End >= BlockEnd)
|
||||
LRCalc.setLiveOutValue(MBB, VNI); // Live-out as well.
|
||||
LRC.setLiveOutValue(MBB, VNI); // Live-out as well.
|
||||
} else {
|
||||
// This block needs a live-in value. The last block covered may not
|
||||
// be live-out.
|
||||
if (End < BlockEnd)
|
||||
LRCalc.addLiveInBlock(LI, MDT[MBB], End);
|
||||
LRC.addLiveInBlock(LI, MDT[MBB], End);
|
||||
else {
|
||||
// Live-through, and we don't know the value.
|
||||
LRCalc.addLiveInBlock(LI, MDT[MBB]);
|
||||
LRCalc.setLiveOutValue(MBB, 0);
|
||||
LRC.addLiveInBlock(LI, MDT[MBB]);
|
||||
LRC.setLiveOutValue(MBB, 0);
|
||||
}
|
||||
}
|
||||
BlockStart = BlockEnd;
|
||||
@ -687,7 +693,11 @@ bool SplitEditor::transferValues() {
|
||||
DEBUG(dbgs() << '\n');
|
||||
}
|
||||
|
||||
LRCalc.calculateValues(LIS.getSlotIndexes(), &MDT, &LIS.getVNInfoAllocator());
|
||||
LRCalc[0].calculateValues(LIS.getSlotIndexes(), &MDT,
|
||||
&LIS.getVNInfoAllocator());
|
||||
if (SpillMode)
|
||||
LRCalc[1].calculateValues(LIS.getSlotIndexes(), &MDT,
|
||||
&LIS.getVNInfoAllocator());
|
||||
|
||||
return Skipped;
|
||||
}
|
||||
|
@ -273,8 +273,17 @@ private:
|
||||
/// The new value has no live ranges anywhere.
|
||||
ValueMap Values;
|
||||
|
||||
/// LRCalc - Cache for computing live ranges and SSA update.
|
||||
LiveRangeCalc LRCalc;
|
||||
/// LRCalc - Cache for computing live ranges and SSA update. Each instance
|
||||
/// can only handle non-overlapping live ranges, so use a separate
|
||||
/// LiveRangeCalc instance for the complement interval when in spill mode.
|
||||
LiveRangeCalc LRCalc[2];
|
||||
|
||||
/// getLRCalc - Return the LRCalc to use for RegIdx. In spill mode, the
|
||||
/// complement interval can overlap the other intervals, so it gets its own
|
||||
/// LRCalc instance. When not in spill mode, all intervals can share one.
|
||||
LiveRangeCalc &getLRCalc(unsigned RegIdx) {
|
||||
return LRCalc[SpillMode != SM_Partition && RegIdx != 0];
|
||||
}
|
||||
|
||||
/// defValue - define a value in RegIdx from ParentVNI at Idx.
|
||||
/// Idx does not have to be ParentVNI->def, but it must be contained within
|
||||
|
Loading…
x
Reference in New Issue
Block a user