mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-15 06:29:05 +00:00
Move LiveIntervalMap::extendTo into LiveInterval itself.
This method could probably be used by LiveIntervalAnalysis::shrinkToUses, and now it can use extendIntervalEndTo() which coalesces ranges. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126803 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -447,6 +447,11 @@ namespace llvm {
|
|||||||
addRangeFrom(LR, ranges.begin());
|
addRangeFrom(LR, ranges.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// extendInBlock - If this interval is live before UseIdx in the basic
|
||||||
|
/// block that starts at StartIdx, extend it to be live at UseIdx and return
|
||||||
|
/// the value. If there is no live range before UseIdx, return NULL.
|
||||||
|
VNInfo *extendInBlock(SlotIndex StartIdx, SlotIndex UseIdx);
|
||||||
|
|
||||||
/// join - Join two live intervals (this, and other) together. This applies
|
/// join - Join two live intervals (this, and other) together. This applies
|
||||||
/// mappings to the value numbers in the LHS/RHS intervals as specified. If
|
/// mappings to the value numbers in the LHS/RHS intervals as specified. If
|
||||||
/// the intervals are not joinable, this aborts.
|
/// the intervals are not joinable, this aborts.
|
||||||
|
@@ -291,6 +291,22 @@ LiveInterval::addRangeFrom(LiveRange LR, iterator From) {
|
|||||||
return ranges.insert(it, LR);
|
return ranges.insert(it, LR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// extendInBlock - If this interval is live before UseIdx in the basic
|
||||||
|
/// block that starts at StartIdx, extend it to be live at UseIdx and return
|
||||||
|
/// the value. If there is no live range before UseIdx, return NULL.
|
||||||
|
VNInfo *LiveInterval::extendInBlock(SlotIndex StartIdx, SlotIndex UseIdx) {
|
||||||
|
if (empty())
|
||||||
|
return 0;
|
||||||
|
iterator I = std::upper_bound(begin(), end(), UseIdx);
|
||||||
|
if (I == begin())
|
||||||
|
return 0;
|
||||||
|
--I;
|
||||||
|
if (I->end <= StartIdx)
|
||||||
|
return 0;
|
||||||
|
if (I->end <= UseIdx)
|
||||||
|
extendIntervalEndTo(I, UseIdx.getNextSlot());
|
||||||
|
return I->valno;
|
||||||
|
}
|
||||||
|
|
||||||
/// removeRange - Remove the specified range from this interval. Note that
|
/// removeRange - Remove the specified range from this interval. Note that
|
||||||
/// the range must be in a single LiveRange in its entirety.
|
/// the range must be in a single LiveRange in its entirety.
|
||||||
|
@@ -230,7 +230,7 @@ VNInfo *LiveIntervalMap::mapValue(const VNInfo *ParentVNI, SlotIndex Idx,
|
|||||||
assert(IdxMBB && "No MBB at Idx");
|
assert(IdxMBB && "No MBB at Idx");
|
||||||
|
|
||||||
// Is there a def in the same MBB we can extend?
|
// Is there a def in the same MBB we can extend?
|
||||||
if (VNInfo *VNI = extendTo(IdxMBB, Idx))
|
if (VNInfo *VNI = LI->extendInBlock(LIS.getMBBStartIdx(IdxMBB), Idx))
|
||||||
return VNI;
|
return VNI;
|
||||||
|
|
||||||
// Now for the fun part. We know that ParentVNI potentially has multiple defs,
|
// Now for the fun part. We know that ParentVNI potentially has multiple defs,
|
||||||
@@ -262,8 +262,10 @@ VNInfo *LiveIntervalMap::mapValue(const VNInfo *ParentVNI, SlotIndex Idx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Does Pred provide a live-out value?
|
// Does Pred provide a live-out value?
|
||||||
SlotIndex Last = LIS.getMBBEndIdx(Pred).getPrevSlot();
|
SlotIndex Start, Last;
|
||||||
if (VNInfo *VNI = extendTo(Pred, Last)) {
|
tie(Start, Last) = LIS.getSlotIndexes()->getMBBRange(Pred);
|
||||||
|
Last = Last.getPrevSlot();
|
||||||
|
if (VNInfo *VNI = LI->extendInBlock(Start, Last)) {
|
||||||
MachineBasicBlock *DefMBB = LIS.getMBBFromIndex(VNI->def);
|
MachineBasicBlock *DefMBB = LIS.getMBBFromIndex(VNI->def);
|
||||||
DEBUG(dbgs() << " found valno #" << VNI->id
|
DEBUG(dbgs() << " found valno #" << VNI->id
|
||||||
<< " from BB#" << DefMBB->getNumber()
|
<< " from BB#" << DefMBB->getNumber()
|
||||||
@@ -429,22 +431,6 @@ void LiveIntervalMap::dumpCache() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// extendTo - Find the last LI value defined in MBB at or before Idx. The
|
|
||||||
// ParentLI is assumed to be live at Idx. Extend the live range to Idx.
|
|
||||||
// Return the found VNInfo, or NULL.
|
|
||||||
VNInfo *LiveIntervalMap::extendTo(const MachineBasicBlock *MBB, SlotIndex Idx) {
|
|
||||||
assert(LI && "call reset first");
|
|
||||||
LiveInterval::iterator I = std::upper_bound(LI->begin(), LI->end(), Idx);
|
|
||||||
if (I == LI->begin())
|
|
||||||
return 0;
|
|
||||||
--I;
|
|
||||||
if (I->end <= LIS.getMBBStartIdx(MBB))
|
|
||||||
return 0;
|
|
||||||
if (I->end <= Idx)
|
|
||||||
I->end = Idx.getNextSlot();
|
|
||||||
return I->valno;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Split Editor
|
// Split Editor
|
||||||
|
@@ -205,11 +205,6 @@ public:
|
|||||||
/// If simple is not NULL, *simple will indicate if ParentVNI is a simply
|
/// If simple is not NULL, *simple will indicate if ParentVNI is a simply
|
||||||
/// mapped value.
|
/// mapped value.
|
||||||
VNInfo *mapValue(const VNInfo *ParentVNI, SlotIndex Idx, bool *simple = 0);
|
VNInfo *mapValue(const VNInfo *ParentVNI, SlotIndex Idx, bool *simple = 0);
|
||||||
|
|
||||||
// extendTo - Find the last LI value defined in MBB at or before Idx. The
|
|
||||||
// parentli is assumed to be live at Idx. Extend the live range to include
|
|
||||||
// Idx. Return the found VNInfo, or NULL.
|
|
||||||
VNInfo *extendTo(const MachineBasicBlock *MBB, SlotIndex Idx);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user