LiveRangeCalc: Rename some parameters from kill to use, NFC.

Those parameters did not necessarily describe kill points but just uses.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229601 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Matthias Braun
2015-02-18 01:50:52 +00:00
parent 00af5b5d50
commit 62be98d510
4 changed files with 39 additions and 40 deletions

View File

@@ -454,10 +454,10 @@ namespace llvm {
/// may have grown since it was inserted). /// may have grown since it was inserted).
iterator addSegment(Segment S); iterator addSegment(Segment S);
/// extendInBlock - If this range is live before Kill in the basic block /// If this range is live before @p Use in the basic block that starts at
/// that starts at StartIdx, extend it to be live up to Kill, and return /// @p StartIdx, extend it to be live up to @p Use, and return the value. If
/// the value. If there is no segment before Kill, return NULL. /// there is no segment before @p Use, return nullptr.
VNInfo *extendInBlock(SlotIndex StartIdx, SlotIndex Kill); VNInfo *extendInBlock(SlotIndex StartIdx, SlotIndex Use);
/// join - Join two live ranges (this, and other) together. This applies /// join - Join two live ranges (this, and other) together. This applies
/// mappings to the value numbers in the LHS/RHS ranges as specified. If /// mappings to the value numbers in the LHS/RHS ranges as specified. If

View File

@@ -88,18 +88,18 @@ public:
return VNI; return VNI;
} }
VNInfo *extendInBlock(SlotIndex StartIdx, SlotIndex Kill) { VNInfo *extendInBlock(SlotIndex StartIdx, SlotIndex Use) {
if (segments().empty()) if (segments().empty())
return nullptr; return nullptr;
iterator I = iterator I =
impl().findInsertPos(Segment(Kill.getPrevSlot(), Kill, nullptr)); impl().findInsertPos(Segment(Use.getPrevSlot(), Use, nullptr));
if (I == segments().begin()) if (I == segments().begin())
return nullptr; return nullptr;
--I; --I;
if (I->end <= StartIdx) if (I->end <= StartIdx)
return nullptr; return nullptr;
if (I->end < Kill) if (I->end < Use)
extendSegmentEndTo(I, Kill); extendSegmentEndTo(I, Use);
return I->valno; return I->valno;
} }

View File

@@ -222,23 +222,23 @@ void LiveRangeCalc::updateFromLiveIns() {
} }
void LiveRangeCalc::extend(LiveRange &LR, SlotIndex Kill, unsigned PhysReg) { void LiveRangeCalc::extend(LiveRange &LR, SlotIndex Use, unsigned PhysReg) {
assert(Kill.isValid() && "Invalid SlotIndex"); assert(Use.isValid() && "Invalid SlotIndex");
assert(Indexes && "Missing SlotIndexes"); assert(Indexes && "Missing SlotIndexes");
assert(DomTree && "Missing dominator tree"); assert(DomTree && "Missing dominator tree");
MachineBasicBlock *KillMBB = Indexes->getMBBFromIndex(Kill.getPrevSlot()); MachineBasicBlock *UseMBB = Indexes->getMBBFromIndex(Use.getPrevSlot());
assert(KillMBB && "No MBB at Kill"); assert(UseMBB && "No MBB at Use");
// Is there a def in the same MBB we can extend? // 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; 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 // 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 // VNInfo SSA form. Perform a search for all predecessor blocks where we
// know the dominating VNInfo. // know the dominating VNInfo.
if (findReachingDefs(LR, *KillMBB, Kill, PhysReg)) if (findReachingDefs(LR, *UseMBB, Use, PhysReg))
return; return;
// When there were multiple different values, we may need new PHIs. // 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, bool LiveRangeCalc::findReachingDefs(LiveRange &LR, MachineBasicBlock &UseMBB,
SlotIndex Kill, unsigned PhysReg) { SlotIndex Use, unsigned PhysReg) {
unsigned KillMBBNum = KillMBB.getNumber(); unsigned UseMBBNum = UseMBB.getNumber();
// Block numbers where LR should be live-in. // 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. // Remember if we have seen more than one value.
bool UniqueVNI = true; 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 // No, we need a live-in value for Pred as well
if (Pred != &KillMBB) if (Pred != &UseMBB)
WorkList.push_back(Pred->getNumber()); WorkList.push_back(Pred->getNumber());
else else
// Loopback to KillMBB, so value is really live through. // Loopback to UseMBB, so value is really live through.
Kill = SlotIndex(); Use = SlotIndex();
} }
} }
@@ -338,9 +338,9 @@ bool LiveRangeCalc::findReachingDefs(LiveRange &LR, MachineBasicBlock &KillMBB,
E = WorkList.end(); I != E; ++I) { E = WorkList.end(); I != E; ++I) {
SlotIndex Start, End; SlotIndex Start, End;
std::tie(Start, End) = Indexes->getMBBRange(*I); std::tie(Start, End) = Indexes->getMBBRange(*I);
// Trim the live range in KillMBB. // Trim the live range in UseMBB.
if (*I == KillMBBNum && Kill.isValid()) if (*I == UseMBBNum && Use.isValid())
End = Kill; End = Use;
else else
Map[MF->getBlockNumbered(*I)] = LiveOutPair(TheVNI, nullptr); Map[MF->getBlockNumbered(*I)] = LiveOutPair(TheVNI, nullptr);
Updater.add(Start, End, TheVNI); 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) { I = WorkList.begin(), E = WorkList.end(); I != E; ++I) {
MachineBasicBlock *MBB = MF->getBlockNumbered(*I); MachineBasicBlock *MBB = MF->getBlockNumbered(*I);
addLiveInBlock(LR, DomTree->getNode(MBB)); addLiveInBlock(LR, DomTree->getNode(MBB));
if (MBB == &KillMBB) if (MBB == &UseMBB)
LiveIn.back().Kill = Kill; LiveIn.back().Kill = Use;
} }
return false; return false;

View File

@@ -101,17 +101,17 @@ class LiveRangeCalc {
/// used to add entries directly. /// used to add entries directly.
SmallVector<LiveInBlock, 16> LiveIn; SmallVector<LiveInBlock, 16> LiveIn;
/// Assuming that LI is live-in to KillMBB and killed at Kill, find the set /// Assuming that @p LR is live-in to @p UseMBB, find the set of defs that can
/// of defs that can reach it. /// reach it.
/// ///
/// If only one def can reach Kill, all paths from the def to kill are added /// If only one def can reach @p UseMBB, all paths from the def to @p UseMBB
/// to LI, and the function returns true. /// 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 /// If multiple values can reach @p UseMBB, the blocks that need @p LR to be
/// are added to the LiveIn array, and the function returns false. /// 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. /// 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); SlotIndex Kill, unsigned PhysReg);
/// updateSSA - Compute the values that will be live in to all requested /// updateSSA - Compute the values that will be live in to all requested
@@ -162,15 +162,14 @@ public:
// Modify existing live ranges. // 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 /// The existing values in @p LR must be live so they jointly dominate @p Use.
/// Kill is not dominated by a single existing value, PHI-defs are inserted /// If @p Use is not dominated by a single existing value, PHI-defs are
/// as required to preserve SSA form. If Kill is known to be dominated by a /// inserted as required to preserve SSA form.
/// single existing value, Alloc may be null.
/// ///
/// PhysReg, when set, is used to verify live-in lists on basic blocks. /// 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. /// createDeadDefs - Create a dead def in LI for every def operand of Reg.
/// Each instruction defining Reg gets a new VNInfo with a corresponding /// Each instruction defining Reg gets a new VNInfo with a corresponding