forked from OSchip/llvm-project
LiveRangeCalc: Rename some parameters from kill to use, NFC.
Those parameters did not necessarily describe kill points but just uses. llvm-svn: 229601
This commit is contained in:
parent
4153f47026
commit
11042c8523
|
@ -454,10 +454,10 @@ namespace llvm {
|
|||
/// may have grown since it was inserted).
|
||||
iterator addSegment(Segment S);
|
||||
|
||||
/// extendInBlock - If this range is live before Kill in the basic block
|
||||
/// that starts at StartIdx, extend it to be live up to Kill, and return
|
||||
/// the value. If there is no segment before Kill, return NULL.
|
||||
VNInfo *extendInBlock(SlotIndex StartIdx, SlotIndex Kill);
|
||||
/// If this range is live before @p Use in the basic block that starts at
|
||||
/// @p StartIdx, extend it to be live up to @p Use, and return the value. If
|
||||
/// there is no segment before @p Use, return nullptr.
|
||||
VNInfo *extendInBlock(SlotIndex StartIdx, SlotIndex Use);
|
||||
|
||||
/// join - Join two live ranges (this, and other) together. This applies
|
||||
/// mappings to the value numbers in the LHS/RHS ranges as specified. If
|
||||
|
|
|
@ -88,18 +88,18 @@ public:
|
|||
return VNI;
|
||||
}
|
||||
|
||||
VNInfo *extendInBlock(SlotIndex StartIdx, SlotIndex Kill) {
|
||||
VNInfo *extendInBlock(SlotIndex StartIdx, SlotIndex Use) {
|
||||
if (segments().empty())
|
||||
return nullptr;
|
||||
iterator I =
|
||||
impl().findInsertPos(Segment(Kill.getPrevSlot(), Kill, nullptr));
|
||||
impl().findInsertPos(Segment(Use.getPrevSlot(), Use, nullptr));
|
||||
if (I == segments().begin())
|
||||
return nullptr;
|
||||
--I;
|
||||
if (I->end <= StartIdx)
|
||||
return nullptr;
|
||||
if (I->end < Kill)
|
||||
extendSegmentEndTo(I, Kill);
|
||||
if (I->end < Use)
|
||||
extendSegmentEndTo(I, Use);
|
||||
return I->valno;
|
||||
}
|
||||
|
||||
|
|
|
@ -222,23 +222,23 @@ void LiveRangeCalc::updateFromLiveIns() {
|
|||
}
|
||||
|
||||
|
||||
void LiveRangeCalc::extend(LiveRange &LR, SlotIndex Kill, unsigned PhysReg) {
|
||||
assert(Kill.isValid() && "Invalid SlotIndex");
|
||||
void LiveRangeCalc::extend(LiveRange &LR, SlotIndex Use, unsigned PhysReg) {
|
||||
assert(Use.isValid() && "Invalid SlotIndex");
|
||||
assert(Indexes && "Missing SlotIndexes");
|
||||
assert(DomTree && "Missing dominator tree");
|
||||
|
||||
MachineBasicBlock *KillMBB = Indexes->getMBBFromIndex(Kill.getPrevSlot());
|
||||
assert(KillMBB && "No MBB at Kill");
|
||||
MachineBasicBlock *UseMBB = Indexes->getMBBFromIndex(Use.getPrevSlot());
|
||||
assert(UseMBB && "No MBB at Use");
|
||||
|
||||
// Is there a def in the same MBB we can extend?
|
||||
if (LR.extendInBlock(Indexes->getMBBStartIdx(KillMBB), Kill))
|
||||
if (LR.extendInBlock(Indexes->getMBBStartIdx(UseMBB), Use))
|
||||
return;
|
||||
|
||||
// Find the single reaching def, or determine if Kill is jointly dominated by
|
||||
// Find the single reaching def, or determine if Use is jointly dominated by
|
||||
// multiple values, and we may need to create even more phi-defs to preserve
|
||||
// VNInfo SSA form. Perform a search for all predecessor blocks where we
|
||||
// know the dominating VNInfo.
|
||||
if (findReachingDefs(LR, *KillMBB, Kill, PhysReg))
|
||||
if (findReachingDefs(LR, *UseMBB, Use, PhysReg))
|
||||
return;
|
||||
|
||||
// When there were multiple different values, we may need new PHIs.
|
||||
|
@ -257,12 +257,12 @@ void LiveRangeCalc::calculateValues() {
|
|||
}
|
||||
|
||||
|
||||
bool LiveRangeCalc::findReachingDefs(LiveRange &LR, MachineBasicBlock &KillMBB,
|
||||
SlotIndex Kill, unsigned PhysReg) {
|
||||
unsigned KillMBBNum = KillMBB.getNumber();
|
||||
bool LiveRangeCalc::findReachingDefs(LiveRange &LR, MachineBasicBlock &UseMBB,
|
||||
SlotIndex Use, unsigned PhysReg) {
|
||||
unsigned UseMBBNum = UseMBB.getNumber();
|
||||
|
||||
// Block numbers where LR should be live-in.
|
||||
SmallVector<unsigned, 16> WorkList(1, KillMBBNum);
|
||||
SmallVector<unsigned, 16> WorkList(1, UseMBBNum);
|
||||
|
||||
// Remember if we have seen more than one value.
|
||||
bool UniqueVNI = true;
|
||||
|
@ -316,11 +316,11 @@ bool LiveRangeCalc::findReachingDefs(LiveRange &LR, MachineBasicBlock &KillMBB,
|
|||
}
|
||||
|
||||
// No, we need a live-in value for Pred as well
|
||||
if (Pred != &KillMBB)
|
||||
if (Pred != &UseMBB)
|
||||
WorkList.push_back(Pred->getNumber());
|
||||
else
|
||||
// Loopback to KillMBB, so value is really live through.
|
||||
Kill = SlotIndex();
|
||||
// Loopback to UseMBB, so value is really live through.
|
||||
Use = SlotIndex();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -338,9 +338,9 @@ bool LiveRangeCalc::findReachingDefs(LiveRange &LR, MachineBasicBlock &KillMBB,
|
|||
E = WorkList.end(); I != E; ++I) {
|
||||
SlotIndex Start, End;
|
||||
std::tie(Start, End) = Indexes->getMBBRange(*I);
|
||||
// Trim the live range in KillMBB.
|
||||
if (*I == KillMBBNum && Kill.isValid())
|
||||
End = Kill;
|
||||
// Trim the live range in UseMBB.
|
||||
if (*I == UseMBBNum && Use.isValid())
|
||||
End = Use;
|
||||
else
|
||||
Map[MF->getBlockNumbered(*I)] = LiveOutPair(TheVNI, nullptr);
|
||||
Updater.add(Start, End, TheVNI);
|
||||
|
@ -355,8 +355,8 @@ bool LiveRangeCalc::findReachingDefs(LiveRange &LR, MachineBasicBlock &KillMBB,
|
|||
I = WorkList.begin(), E = WorkList.end(); I != E; ++I) {
|
||||
MachineBasicBlock *MBB = MF->getBlockNumbered(*I);
|
||||
addLiveInBlock(LR, DomTree->getNode(MBB));
|
||||
if (MBB == &KillMBB)
|
||||
LiveIn.back().Kill = Kill;
|
||||
if (MBB == &UseMBB)
|
||||
LiveIn.back().Kill = Use;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -101,17 +101,17 @@ class LiveRangeCalc {
|
|||
/// used to add entries directly.
|
||||
SmallVector<LiveInBlock, 16> LiveIn;
|
||||
|
||||
/// Assuming that LI is live-in to KillMBB and killed at Kill, find the set
|
||||
/// of defs that can reach it.
|
||||
/// Assuming that @p LR is live-in to @p UseMBB, find the set of defs that can
|
||||
/// reach it.
|
||||
///
|
||||
/// If only one def can reach Kill, all paths from the def to kill are added
|
||||
/// to LI, and the function returns true.
|
||||
/// If only one def can reach @p UseMBB, all paths from the def to @p UseMBB
|
||||
/// are added to @p LR, and the function returns true.
|
||||
///
|
||||
/// If multiple values can reach Kill, the blocks that need LI to be live in
|
||||
/// are added to the LiveIn array, and the function returns false.
|
||||
/// If multiple values can reach @p UseMBB, the blocks that need @p LR to be
|
||||
/// live in are added to the LiveIn array, and the function returns false.
|
||||
///
|
||||
/// PhysReg, when set, is used to verify live-in lists on basic blocks.
|
||||
bool findReachingDefs(LiveRange &LR, MachineBasicBlock &KillMBB,
|
||||
bool findReachingDefs(LiveRange &LR, MachineBasicBlock &UseMBB,
|
||||
SlotIndex Kill, unsigned PhysReg);
|
||||
|
||||
/// updateSSA - Compute the values that will be live in to all requested
|
||||
|
@ -162,15 +162,14 @@ public:
|
|||
// Modify existing live ranges.
|
||||
//
|
||||
|
||||
/// extend - Extend the live range of LI to reach Kill.
|
||||
/// Extend the live range of @p LR to reach @p Use.
|
||||
///
|
||||
/// The existing values in LI must be live so they jointly dominate Kill. If
|
||||
/// Kill is not dominated by a single existing value, PHI-defs are inserted
|
||||
/// as required to preserve SSA form. If Kill is known to be dominated by a
|
||||
/// single existing value, Alloc may be null.
|
||||
/// The existing values in @p LR must be live so they jointly dominate @p Use.
|
||||
/// If @p Use is not dominated by a single existing value, PHI-defs are
|
||||
/// inserted as required to preserve SSA form.
|
||||
///
|
||||
/// PhysReg, when set, is used to verify live-in lists on basic blocks.
|
||||
void extend(LiveRange &LR, SlotIndex Kill, unsigned PhysReg = 0);
|
||||
void extend(LiveRange &LR, SlotIndex Use, unsigned PhysReg = 0);
|
||||
|
||||
/// createDeadDefs - Create a dead def in LI for every def operand of Reg.
|
||||
/// Each instruction defining Reg gets a new VNInfo with a corresponding
|
||||
|
|
Loading…
Reference in New Issue