1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

Eliminate the extendRange() wrapper.

llvm-svn: 139608
This commit is contained in:
Jakob Stoklund Olesen 2011-09-13 17:38:57 +00:00
parent 4cdd5fca36
commit bcb7c275ee
2 changed files with 15 additions and 20 deletions

View File

@ -391,13 +391,6 @@ void SplitEditor::markComplexMapped(unsigned RegIdx, const VNInfo *ParentVNI) {
VNI = 0; VNI = 0;
} }
// extendRange - Extend the live range to reach Idx.
// Potentially create phi-def values.
void SplitEditor::extendRange(unsigned RegIdx, SlotIndex Idx) {
getLRCalc(RegIdx).extend(Edit->get(RegIdx), Idx.getNextSlot(),
LIS.getSlotIndexes(), &MDT, &LIS.getVNInfoAllocator());
}
VNInfo *SplitEditor::defFromParent(unsigned RegIdx, VNInfo *SplitEditor::defFromParent(unsigned RegIdx,
VNInfo *ParentVNI, VNInfo *ParentVNI,
SlotIndex UseIdx, SlotIndex UseIdx,
@ -580,7 +573,7 @@ void SplitEditor::overlapIntv(SlotIndex Start, SlotIndex End) {
assert(LIS.getMBBFromIndex(Start) == LIS.getMBBFromIndex(End) && assert(LIS.getMBBFromIndex(Start) == LIS.getMBBFromIndex(End) &&
"Range cannot span basic blocks"); "Range cannot span basic blocks");
// The complement interval will be extended as needed by extendRange(). // The complement interval will be extended as needed by LRCalc.extend().
if (ParentVNI) if (ParentVNI)
markComplexMapped(0, ParentVNI); markComplexMapped(0, ParentVNI);
DEBUG(dbgs() << " overlapIntv [" << Start << ';' << End << "):"); DEBUG(dbgs() << " overlapIntv [" << Start << ';' << End << "):");
@ -589,7 +582,7 @@ void SplitEditor::overlapIntv(SlotIndex Start, SlotIndex End) {
} }
/// transferValues - Transfer all possible values to the new live ranges. /// transferValues - Transfer all possible values to the new live ranges.
/// Values that were rematerialized are left alone, they need extendRange(). /// Values that were rematerialized are left alone, they need LRCalc.extend().
bool SplitEditor::transferValues() { bool SplitEditor::transferValues() {
bool Skipped = false; bool Skipped = false;
RegAssignMap::const_iterator AssignI = RegAssign.begin(); RegAssignMap::const_iterator AssignI = RegAssign.begin();
@ -628,7 +621,7 @@ bool SplitEditor::transferValues() {
continue; continue;
} }
// Skip rematerialized values, we need to use extendRange() and // Skip rematerialized values, we need to use LRCalc.extend() and
// extendPHIKillRanges() to completely recompute the live ranges. // extendPHIKillRanges() to completely recompute the live ranges.
if (Edit->didRematerialize(ParentVNI)) { if (Edit->didRematerialize(ParentVNI)) {
DEBUG(dbgs() << "(remat)"); DEBUG(dbgs() << "(remat)");
@ -708,16 +701,20 @@ void SplitEditor::extendPHIKillRanges() {
if (PHIVNI->isUnused() || !PHIVNI->isPHIDef()) if (PHIVNI->isUnused() || !PHIVNI->isPHIDef())
continue; continue;
unsigned RegIdx = RegAssign.lookup(PHIVNI->def); unsigned RegIdx = RegAssign.lookup(PHIVNI->def);
LiveInterval *LI = Edit->get(RegIdx);
LiveRangeCalc &LRC = getLRCalc(RegIdx);
MachineBasicBlock *MBB = LIS.getMBBFromIndex(PHIVNI->def); MachineBasicBlock *MBB = LIS.getMBBFromIndex(PHIVNI->def);
for (MachineBasicBlock::pred_iterator PI = MBB->pred_begin(), for (MachineBasicBlock::pred_iterator PI = MBB->pred_begin(),
PE = MBB->pred_end(); PI != PE; ++PI) { PE = MBB->pred_end(); PI != PE; ++PI) {
SlotIndex End = LIS.getMBBEndIdx(*PI).getPrevSlot(); SlotIndex End = LIS.getMBBEndIdx(*PI);
SlotIndex LastUse = End.getPrevSlot();
// The predecessor may not have a live-out value. That is OK, like an // The predecessor may not have a live-out value. That is OK, like an
// undef PHI operand. // undef PHI operand.
if (Edit->getParent().liveAt(End)) { if (Edit->getParent().liveAt(LastUse)) {
assert(RegAssign.lookup(End) == RegIdx && assert(RegAssign.lookup(LastUse) == RegIdx &&
"Different register assignment in phi predecessor"); "Different register assignment in phi predecessor");
extendRange(RegIdx, End); LRC.extend(LI, End,
LIS.getSlotIndexes(), &MDT, &LIS.getVNInfoAllocator());
} }
} }
} }
@ -746,7 +743,8 @@ void SplitEditor::rewriteAssigned(bool ExtendRanges) {
// Rewrite to the mapped register at Idx. // Rewrite to the mapped register at Idx.
unsigned RegIdx = RegAssign.lookup(Idx); unsigned RegIdx = RegAssign.lookup(Idx);
MO.setReg(Edit->get(RegIdx)->reg); LiveInterval *LI = Edit->get(RegIdx);
MO.setReg(LI->reg);
DEBUG(dbgs() << " rewr BB#" << MI->getParent()->getNumber() << '\t' DEBUG(dbgs() << " rewr BB#" << MI->getParent()->getNumber() << '\t'
<< Idx << ':' << RegIdx << '\t' << *MI); << Idx << ':' << RegIdx << '\t' << *MI);
@ -766,7 +764,8 @@ void SplitEditor::rewriteAssigned(bool ExtendRanges) {
} else } else
Idx = Idx.getUseIndex(); Idx = Idx.getUseIndex();
extendRange(RegIdx, Idx); getLRCalc(RegIdx).extend(LI, Idx.getNextSlot(), LIS.getSlotIndexes(),
&MDT, &LIS.getVNInfoAllocator());
} }
} }

View File

@ -304,10 +304,6 @@ private:
MachineBasicBlock &MBB, MachineBasicBlock &MBB,
MachineBasicBlock::iterator I); MachineBasicBlock::iterator I);
/// extendRange - Extend the live range of Edit.get(RegIdx) so it reaches Idx.
/// Insert PHIDefs as needed to preserve SSA form.
void extendRange(unsigned RegIdx, SlotIndex Idx);
/// transferValues - Transfer values to the new ranges. /// transferValues - Transfer values to the new ranges.
/// Return true if any ranges were skipped. /// Return true if any ranges were skipped.
bool transferValues(); bool transferValues();