Rename mapValue to extendRange because that is its function now.

Simplify the signature - The return value and ParentVNI are no longer needed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126809 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jakob Stoklund Olesen 2011-03-02 00:49:28 +00:00
parent e0ab24532c
commit d3fdaeb69a
2 changed files with 12 additions and 30 deletions

View File

@ -214,24 +214,17 @@ void LiveIntervalMap::reset(LiveInterval *li) {
}
// mapValue - Find the mapped value for ParentVNI at Idx.
// extendRange - Extend the live range to reach Idx.
// Potentially create phi-def values.
VNInfo *LiveIntervalMap::mapValue(const VNInfo *ParentVNI, SlotIndex Idx,
bool *simple) {
void LiveIntervalMap::extendRange(SlotIndex Idx) {
assert(LI && "call reset first");
assert(ParentVNI && "Mapping NULL value");
assert(Idx.isValid() && "Invalid SlotIndex");
assert(ParentLI.getVNInfoAt(Idx) == ParentVNI && "Bad ParentVNI");
// This is a complex mapped value. There may be multiple defs, and we may need
// to create phi-defs.
if (simple) *simple = false;
MachineBasicBlock *IdxMBB = LIS.getMBBFromIndex(Idx);
assert(IdxMBB && "No MBB at Idx");
// Is there a def in the same MBB we can extend?
if (VNInfo *VNI = LI->extendInBlock(LIS.getMBBStartIdx(IdxMBB), Idx))
return VNI;
if (LI->extendInBlock(LIS.getMBBStartIdx(IdxMBB), Idx))
return;
// Now for the fun part. We know that ParentVNI potentially has multiple defs,
// and we may need to create even more phi-defs to preserve VNInfo SSA form.
@ -395,7 +388,6 @@ VNInfo *LiveIntervalMap::mapValue(const VNInfo *ParentVNI, SlotIndex Idx,
// Since we went through the trouble of a full BFS visiting all reaching defs,
// the values in LiveIn are now accurate. No more phi-defs are needed
// for these blocks, so we can color the live ranges.
// This makes the next mapValue call much faster.
for (unsigned i = 0, e = LiveIn.size(); i != e; ++i) {
MachineBasicBlock *MBB = LiveIn[i]->getBlock();
SlotIndex Start = LIS.getMBBStartIdx(MBB);
@ -408,8 +400,6 @@ VNInfo *LiveIntervalMap::mapValue(const VNInfo *ParentVNI, SlotIndex Idx,
else
LI->addRange(LiveRange(Start, LIS.getMBBEndIdx(MBB), VNI));
}
return IdxVNI;
}
#ifndef NDEBUG
@ -681,8 +671,8 @@ void SplitEditor::overlapIntv(SlotIndex Start, SlotIndex End) {
assert(LIS.getMBBFromIndex(Start) == LIS.getMBBFromIndex(End) &&
"Range cannot span basic blocks");
// Treat this as useIntv() for now. The complement interval will be extended
// as needed by mapValue().
// Treat this as useIntv() for now.
// The complement interval will be extended as needed by extendRange().
DEBUG(dbgs() << " overlapIntv [" << Start << ';' << End << "):");
RegAssign.insert(Start, End, OpenIdx);
DEBUG(dump());
@ -726,8 +716,7 @@ void SplitEditor::rewriteAssigned() {
<< Idx << ':' << RegIdx << '\t' << *MI);
// Extend liveness to Idx.
const VNInfo *ParentVNI = Edit.getParent().getVNInfoAt(Idx);
LIMappers[RegIdx].mapValue(ParentVNI, Idx);
LIMappers[RegIdx].extendRange(Idx);
}
}
@ -780,7 +769,7 @@ void SplitEditor::finish() {
// FIXME: Don't recompute the liveness of all values, infer it from the
// overlaps between the parent live interval and RegAssign.
// The mapValue algorithm is only necessary when:
// The extendRange algorithm is only necessary when:
// - The parent value maps to multiple defs, and new phis are needed, or
// - The value has been rematerialized before some uses, and we want to
// minimize the live range so it only reaches the remaining uses.
@ -808,7 +797,7 @@ void SplitEditor::finish() {
DEBUG(dbgs() << " has parent valno #" << VNI->id << " live out\n");
assert(RegAssign.lookup(End) == RegIdx &&
"Different register assignment in phi predecessor");
LIM.mapValue(VNI, End);
LIM.extendRange(End);
}
else
DEBUG(dbgs() << " is not live-out\n");

View File

@ -195,16 +195,9 @@ public:
/// getLI - return the current live interval.
LiveInterval *getLI() const { return LI; }
/// mapValue - map ParentVNI to the corresponding LI value at Idx. It is
/// assumed that ParentVNI is live at Idx.
/// If ParentVNI has not been defined by defValue, it is assumed that
/// ParentVNI->def dominates Idx.
/// If ParentVNI has been defined by defValue one or more times, a value that
/// dominates Idx will be returned. This may require creating extra phi-def
/// values and adding live ranges to LI.
/// If simple is not NULL, *simple will indicate if ParentVNI is a simply
/// mapped value.
VNInfo *mapValue(const VNInfo *ParentVNI, SlotIndex Idx, bool *simple = 0);
/// extendRange - Extend the live range of LI so it reaches Idx.
/// Insert PHIDefs as needed to preserve SSA form.
void extendRange(SlotIndex Idx);
};