Skip to content

Commit 11042c8

Browse files
committed
LiveRangeCalc: Rename some parameters from kill to use, NFC.
Those parameters did not necessarily describe kill points but just uses. llvm-svn: 229601
1 parent 4153f47 commit 11042c8

File tree

4 files changed

+39
-40
lines changed

4 files changed

+39
-40
lines changed

llvm/include/llvm/CodeGen/LiveInterval.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -454,10 +454,10 @@ namespace llvm {
454454
/// may have grown since it was inserted).
455455
iterator addSegment(Segment S);
456456

457-
/// extendInBlock - If this range is live before Kill in the basic block
458-
/// that starts at StartIdx, extend it to be live up to Kill, and return
459-
/// the value. If there is no segment before Kill, return NULL.
460-
VNInfo *extendInBlock(SlotIndex StartIdx, SlotIndex Kill);
457+
/// If this range is live before @p Use in the basic block that starts at
458+
/// @p StartIdx, extend it to be live up to @p Use, and return the value. If
459+
/// there is no segment before @p Use, return nullptr.
460+
VNInfo *extendInBlock(SlotIndex StartIdx, SlotIndex Use);
461461

462462
/// join - Join two live ranges (this, and other) together. This applies
463463
/// mappings to the value numbers in the LHS/RHS ranges as specified. If

llvm/lib/CodeGen/LiveInterval.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,18 +88,18 @@ class CalcLiveRangeUtilBase {
8888
return VNI;
8989
}
9090

91-
VNInfo *extendInBlock(SlotIndex StartIdx, SlotIndex Kill) {
91+
VNInfo *extendInBlock(SlotIndex StartIdx, SlotIndex Use) {
9292
if (segments().empty())
9393
return nullptr;
9494
iterator I =
95-
impl().findInsertPos(Segment(Kill.getPrevSlot(), Kill, nullptr));
95+
impl().findInsertPos(Segment(Use.getPrevSlot(), Use, nullptr));
9696
if (I == segments().begin())
9797
return nullptr;
9898
--I;
9999
if (I->end <= StartIdx)
100100
return nullptr;
101-
if (I->end < Kill)
102-
extendSegmentEndTo(I, Kill);
101+
if (I->end < Use)
102+
extendSegmentEndTo(I, Use);
103103
return I->valno;
104104
}
105105

llvm/lib/CodeGen/LiveRangeCalc.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -222,23 +222,23 @@ void LiveRangeCalc::updateFromLiveIns() {
222222
}
223223

224224

225-
void LiveRangeCalc::extend(LiveRange &LR, SlotIndex Kill, unsigned PhysReg) {
226-
assert(Kill.isValid() && "Invalid SlotIndex");
225+
void LiveRangeCalc::extend(LiveRange &LR, SlotIndex Use, unsigned PhysReg) {
226+
assert(Use.isValid() && "Invalid SlotIndex");
227227
assert(Indexes && "Missing SlotIndexes");
228228
assert(DomTree && "Missing dominator tree");
229229

230-
MachineBasicBlock *KillMBB = Indexes->getMBBFromIndex(Kill.getPrevSlot());
231-
assert(KillMBB && "No MBB at Kill");
230+
MachineBasicBlock *UseMBB = Indexes->getMBBFromIndex(Use.getPrevSlot());
231+
assert(UseMBB && "No MBB at Use");
232232

233233
// Is there a def in the same MBB we can extend?
234-
if (LR.extendInBlock(Indexes->getMBBStartIdx(KillMBB), Kill))
234+
if (LR.extendInBlock(Indexes->getMBBStartIdx(UseMBB), Use))
235235
return;
236236

237-
// Find the single reaching def, or determine if Kill is jointly dominated by
237+
// Find the single reaching def, or determine if Use is jointly dominated by
238238
// multiple values, and we may need to create even more phi-defs to preserve
239239
// VNInfo SSA form. Perform a search for all predecessor blocks where we
240240
// know the dominating VNInfo.
241-
if (findReachingDefs(LR, *KillMBB, Kill, PhysReg))
241+
if (findReachingDefs(LR, *UseMBB, Use, PhysReg))
242242
return;
243243

244244
// When there were multiple different values, we may need new PHIs.
@@ -257,12 +257,12 @@ void LiveRangeCalc::calculateValues() {
257257
}
258258

259259

260-
bool LiveRangeCalc::findReachingDefs(LiveRange &LR, MachineBasicBlock &KillMBB,
261-
SlotIndex Kill, unsigned PhysReg) {
262-
unsigned KillMBBNum = KillMBB.getNumber();
260+
bool LiveRangeCalc::findReachingDefs(LiveRange &LR, MachineBasicBlock &UseMBB,
261+
SlotIndex Use, unsigned PhysReg) {
262+
unsigned UseMBBNum = UseMBB.getNumber();
263263

264264
// Block numbers where LR should be live-in.
265-
SmallVector<unsigned, 16> WorkList(1, KillMBBNum);
265+
SmallVector<unsigned, 16> WorkList(1, UseMBBNum);
266266

267267
// Remember if we have seen more than one value.
268268
bool UniqueVNI = true;
@@ -316,11 +316,11 @@ bool LiveRangeCalc::findReachingDefs(LiveRange &LR, MachineBasicBlock &KillMBB,
316316
}
317317

318318
// No, we need a live-in value for Pred as well
319-
if (Pred != &KillMBB)
319+
if (Pred != &UseMBB)
320320
WorkList.push_back(Pred->getNumber());
321321
else
322-
// Loopback to KillMBB, so value is really live through.
323-
Kill = SlotIndex();
322+
// Loopback to UseMBB, so value is really live through.
323+
Use = SlotIndex();
324324
}
325325
}
326326

@@ -338,9 +338,9 @@ bool LiveRangeCalc::findReachingDefs(LiveRange &LR, MachineBasicBlock &KillMBB,
338338
E = WorkList.end(); I != E; ++I) {
339339
SlotIndex Start, End;
340340
std::tie(Start, End) = Indexes->getMBBRange(*I);
341-
// Trim the live range in KillMBB.
342-
if (*I == KillMBBNum && Kill.isValid())
343-
End = Kill;
341+
// Trim the live range in UseMBB.
342+
if (*I == UseMBBNum && Use.isValid())
343+
End = Use;
344344
else
345345
Map[MF->getBlockNumbered(*I)] = LiveOutPair(TheVNI, nullptr);
346346
Updater.add(Start, End, TheVNI);
@@ -355,8 +355,8 @@ bool LiveRangeCalc::findReachingDefs(LiveRange &LR, MachineBasicBlock &KillMBB,
355355
I = WorkList.begin(), E = WorkList.end(); I != E; ++I) {
356356
MachineBasicBlock *MBB = MF->getBlockNumbered(*I);
357357
addLiveInBlock(LR, DomTree->getNode(MBB));
358-
if (MBB == &KillMBB)
359-
LiveIn.back().Kill = Kill;
358+
if (MBB == &UseMBB)
359+
LiveIn.back().Kill = Use;
360360
}
361361

362362
return false;

llvm/lib/CodeGen/LiveRangeCalc.h

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,17 @@ class LiveRangeCalc {
101101
/// used to add entries directly.
102102
SmallVector<LiveInBlock, 16> LiveIn;
103103

104-
/// Assuming that LI is live-in to KillMBB and killed at Kill, find the set
105-
/// of defs that can reach it.
104+
/// Assuming that @p LR is live-in to @p UseMBB, find the set of defs that can
105+
/// reach it.
106106
///
107-
/// If only one def can reach Kill, all paths from the def to kill are added
108-
/// to LI, and the function returns true.
107+
/// If only one def can reach @p UseMBB, all paths from the def to @p UseMBB
108+
/// are added to @p LR, and the function returns true.
109109
///
110-
/// If multiple values can reach Kill, the blocks that need LI to be live in
111-
/// are added to the LiveIn array, and the function returns false.
110+
/// If multiple values can reach @p UseMBB, the blocks that need @p LR to be
111+
/// live in are added to the LiveIn array, and the function returns false.
112112
///
113113
/// PhysReg, when set, is used to verify live-in lists on basic blocks.
114-
bool findReachingDefs(LiveRange &LR, MachineBasicBlock &KillMBB,
114+
bool findReachingDefs(LiveRange &LR, MachineBasicBlock &UseMBB,
115115
SlotIndex Kill, unsigned PhysReg);
116116

117117
/// updateSSA - Compute the values that will be live in to all requested
@@ -162,15 +162,14 @@ class LiveRangeCalc {
162162
// Modify existing live ranges.
163163
//
164164

165-
/// extend - Extend the live range of LI to reach Kill.
165+
/// Extend the live range of @p LR to reach @p Use.
166166
///
167-
/// The existing values in LI must be live so they jointly dominate Kill. If
168-
/// Kill is not dominated by a single existing value, PHI-defs are inserted
169-
/// as required to preserve SSA form. If Kill is known to be dominated by a
170-
/// single existing value, Alloc may be null.
167+
/// The existing values in @p LR must be live so they jointly dominate @p Use.
168+
/// If @p Use is not dominated by a single existing value, PHI-defs are
169+
/// inserted as required to preserve SSA form.
171170
///
172171
/// PhysReg, when set, is used to verify live-in lists on basic blocks.
173-
void extend(LiveRange &LR, SlotIndex Kill, unsigned PhysReg = 0);
172+
void extend(LiveRange &LR, SlotIndex Use, unsigned PhysReg = 0);
174173

175174
/// createDeadDefs - Create a dead def in LI for every def operand of Reg.
176175
/// Each instruction defining Reg gets a new VNInfo with a corresponding

0 commit comments

Comments
 (0)