Renamed MachineInstrIndex to LiveIndex.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83254 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/PreAllocSplitting.cpp b/lib/CodeGen/PreAllocSplitting.cpp
index 2e20dc1..dbafcc0 100644
--- a/lib/CodeGen/PreAllocSplitting.cpp
+++ b/lib/CodeGen/PreAllocSplitting.cpp
@@ -68,7 +68,7 @@
MachineBasicBlock *BarrierMBB;
// Barrier - Current barrier index.
- MachineInstrIndex BarrierIdx;
+ LiveIndex BarrierIdx;
// CurrLI - Current live interval being split.
LiveInterval *CurrLI;
@@ -83,7 +83,7 @@
DenseMap<unsigned, int> IntervalSSMap;
// Def2SpillMap - A map from a def instruction index to spill index.
- DenseMap<MachineInstrIndex, MachineInstrIndex> Def2SpillMap;
+ DenseMap<LiveIndex, MachineInstrIndex> Def2SpillMap;
public:
static char ID;
@@ -129,23 +129,23 @@
private:
MachineBasicBlock::iterator
findNextEmptySlot(MachineBasicBlock*, MachineInstr*,
- MachineInstrIndex&);
+ LiveIndex&);
MachineBasicBlock::iterator
findSpillPoint(MachineBasicBlock*, MachineInstr*, MachineInstr*,
- SmallPtrSet<MachineInstr*, 4>&, MachineInstrIndex&);
+ SmallPtrSet<MachineInstr*, 4>&, LiveIndex&);
MachineBasicBlock::iterator
- findRestorePoint(MachineBasicBlock*, MachineInstr*, MachineInstrIndex,
- SmallPtrSet<MachineInstr*, 4>&, MachineInstrIndex&);
+ findRestorePoint(MachineBasicBlock*, MachineInstr*, LiveIndex,
+ SmallPtrSet<MachineInstr*, 4>&, LiveIndex&);
int CreateSpillStackSlot(unsigned, const TargetRegisterClass *);
bool IsAvailableInStack(MachineBasicBlock*, unsigned,
- MachineInstrIndex, MachineInstrIndex,
- MachineInstrIndex&, int&) const;
+ LiveIndex, MachineInstrIndex,
+ LiveIndex&, int&) const;
- void UpdateSpillSlotInterval(VNInfo*, MachineInstrIndex, MachineInstrIndex);
+ void UpdateSpillSlotInterval(VNInfo*, LiveIndex, MachineInstrIndex);
bool SplitRegLiveInterval(LiveInterval*);
@@ -157,7 +157,7 @@
bool Rematerialize(unsigned vreg, VNInfo* ValNo,
MachineInstr* DefMI,
MachineBasicBlock::iterator RestorePt,
- MachineInstrIndex RestoreIdx,
+ LiveIndex RestoreIdx,
SmallPtrSet<MachineInstr*, 4>& RefsInMBB);
MachineInstr* FoldSpill(unsigned vreg, const TargetRegisterClass* RC,
MachineInstr* DefMI,
@@ -209,12 +209,12 @@
/// instruction index map. If there isn't one, return end().
MachineBasicBlock::iterator
PreAllocSplitting::findNextEmptySlot(MachineBasicBlock *MBB, MachineInstr *MI,
- MachineInstrIndex &SpotIndex) {
+ LiveIndex &SpotIndex) {
MachineBasicBlock::iterator MII = MI;
if (++MII != MBB->end()) {
- MachineInstrIndex Index =
+ LiveIndex Index =
LIs->findGapBeforeInstr(LIs->getInstructionIndex(MII));
- if (Index != MachineInstrIndex()) {
+ if (Index != LiveIndex()) {
SpotIndex = Index;
return MII;
}
@@ -230,7 +230,7 @@
PreAllocSplitting::findSpillPoint(MachineBasicBlock *MBB, MachineInstr *MI,
MachineInstr *DefMI,
SmallPtrSet<MachineInstr*, 4> &RefsInMBB,
- MachineInstrIndex &SpillIndex) {
+ LiveIndex &SpillIndex) {
MachineBasicBlock::iterator Pt = MBB->begin();
MachineBasicBlock::iterator MII = MI;
@@ -243,7 +243,7 @@
if (MII == EndPt || RefsInMBB.count(MII)) return Pt;
while (MII != EndPt && !RefsInMBB.count(MII)) {
- MachineInstrIndex Index = LIs->getInstructionIndex(MII);
+ LiveIndex Index = LIs->getInstructionIndex(MII);
// We can't insert the spill between the barrier (a call), and its
// corresponding call frame setup.
@@ -276,9 +276,9 @@
/// found.
MachineBasicBlock::iterator
PreAllocSplitting::findRestorePoint(MachineBasicBlock *MBB, MachineInstr *MI,
- MachineInstrIndex LastIdx,
+ LiveIndex LastIdx,
SmallPtrSet<MachineInstr*, 4> &RefsInMBB,
- MachineInstrIndex &RestoreIndex) {
+ LiveIndex &RestoreIndex) {
// FIXME: Allow spill to be inserted to the beginning of the mbb. Update mbb
// begin index accordingly.
MachineBasicBlock::iterator Pt = MBB->end();
@@ -299,10 +299,10 @@
// FIXME: Limit the number of instructions to examine to reduce
// compile time?
while (MII != EndPt) {
- MachineInstrIndex Index = LIs->getInstructionIndex(MII);
+ LiveIndex Index = LIs->getInstructionIndex(MII);
if (Index > LastIdx)
break;
- MachineInstrIndex Gap = LIs->findGapBeforeInstr(Index);
+ LiveIndex Gap = LIs->findGapBeforeInstr(Index);
// We can't insert a restore between the barrier (a call) and its
// corresponding call frame teardown.
@@ -311,7 +311,7 @@
if (MII == EndPt || RefsInMBB.count(MII)) return Pt;
++MII;
} while (MII->getOpcode() != TRI->getCallFrameDestroyOpcode());
- } else if (Gap != MachineInstrIndex()) {
+ } else if (Gap != LiveIndex()) {
Pt = MII;
RestoreIndex = Gap;
}
@@ -344,7 +344,7 @@
if (CurrSLI->hasAtLeastOneValue())
CurrSValNo = CurrSLI->getValNumInfo(0);
else
- CurrSValNo = CurrSLI->getNextValue(MachineInstrIndex(), 0, false,
+ CurrSValNo = CurrSLI->getNextValue(LiveIndex(), 0, false,
LSs->getVNInfoAllocator());
return SS;
}
@@ -353,9 +353,9 @@
/// slot at the specified index.
bool
PreAllocSplitting::IsAvailableInStack(MachineBasicBlock *DefMBB,
- unsigned Reg, MachineInstrIndex DefIndex,
- MachineInstrIndex RestoreIndex,
- MachineInstrIndex &SpillIndex,
+ unsigned Reg, LiveIndex DefIndex,
+ LiveIndex RestoreIndex,
+ LiveIndex &SpillIndex,
int& SS) const {
if (!DefMBB)
return false;
@@ -363,7 +363,7 @@
DenseMap<unsigned, int>::iterator I = IntervalSSMap.find(Reg);
if (I == IntervalSSMap.end())
return false;
- DenseMap<MachineInstrIndex, MachineInstrIndex>::iterator
+ DenseMap<LiveIndex, MachineInstrIndex>::iterator
II = Def2SpillMap.find(DefIndex);
if (II == Def2SpillMap.end())
return false;
@@ -384,8 +384,8 @@
/// interval being split, and the spill and restore indicies, update the live
/// interval of the spill stack slot.
void
-PreAllocSplitting::UpdateSpillSlotInterval(VNInfo *ValNo, MachineInstrIndex SpillIndex,
- MachineInstrIndex RestoreIndex) {
+PreAllocSplitting::UpdateSpillSlotInterval(VNInfo *ValNo, LiveIndex SpillIndex,
+ LiveIndex RestoreIndex) {
assert(LIs->getMBBFromIndex(RestoreIndex) == BarrierMBB &&
"Expect restore in the barrier mbb");
@@ -398,7 +398,7 @@
}
SmallPtrSet<MachineBasicBlock*, 4> Processed;
- MachineInstrIndex EndIdx = LIs->getMBBEndIdx(MBB);
+ LiveIndex EndIdx = LIs->getMBBEndIdx(MBB);
LiveRange SLR(SpillIndex, LIs->getNextSlot(EndIdx), CurrSValNo);
CurrSLI->addRange(SLR);
Processed.insert(MBB);
@@ -418,7 +418,7 @@
WorkList.pop_back();
if (Processed.count(MBB))
continue;
- MachineInstrIndex Idx = LIs->getMBBStartIdx(MBB);
+ LiveIndex Idx = LIs->getMBBStartIdx(MBB);
LR = CurrLI->getLiveRangeContaining(Idx);
if (LR && LR->valno == ValNo) {
EndIdx = LIs->getMBBEndIdx(MBB);
@@ -491,9 +491,9 @@
}
// Once we've found it, extend its VNInfo to our instruction.
- MachineInstrIndex DefIndex = LIs->getInstructionIndex(Walker);
+ LiveIndex DefIndex = LIs->getInstructionIndex(Walker);
DefIndex = LIs->getDefIndex(DefIndex);
- MachineInstrIndex EndIndex = LIs->getMBBEndIdx(MBB);
+ LiveIndex EndIndex = LIs->getMBBEndIdx(MBB);
RetVNI = NewVNs[Walker];
LI->addRange(LiveRange(DefIndex, LIs->getNextSlot(EndIndex), RetVNI));
@@ -528,9 +528,9 @@
IsTopLevel, IsIntraBlock);
}
- MachineInstrIndex UseIndex = LIs->getInstructionIndex(Walker);
+ LiveIndex UseIndex = LIs->getInstructionIndex(Walker);
UseIndex = LIs->getUseIndex(UseIndex);
- MachineInstrIndex EndIndex;
+ LiveIndex EndIndex;
if (IsIntraBlock) {
EndIndex = LIs->getInstructionIndex(UseI);
EndIndex = LIs->getUseIndex(EndIndex);
@@ -588,10 +588,10 @@
IsTopLevel, IsIntraBlock);
}
- MachineInstrIndex StartIndex = LIs->getInstructionIndex(Walker);
+ LiveIndex StartIndex = LIs->getInstructionIndex(Walker);
StartIndex = foundDef ? LIs->getDefIndex(StartIndex) :
LIs->getUseIndex(StartIndex);
- MachineInstrIndex EndIndex;
+ LiveIndex EndIndex;
if (IsIntraBlock) {
EndIndex = LIs->getInstructionIndex(UseI);
EndIndex = LIs->getUseIndex(EndIndex);
@@ -640,9 +640,9 @@
// assume that we are not intrablock here.
if (Phis.count(MBB)) return Phis[MBB];
- MachineInstrIndex StartIndex = LIs->getMBBStartIdx(MBB);
+ LiveIndex StartIndex = LIs->getMBBStartIdx(MBB);
VNInfo *RetVNI = Phis[MBB] =
- LI->getNextValue(MachineInstrIndex(), /*FIXME*/ 0, false,
+ LI->getNextValue(LiveIndex(), /*FIXME*/ 0, false,
LIs->getVNInfoAllocator());
if (!IsIntraBlock) LiveOut[MBB] = RetVNI;
@@ -685,13 +685,13 @@
for (DenseMap<MachineBasicBlock*, VNInfo*>::iterator I =
IncomingVNs.begin(), E = IncomingVNs.end(); I != E; ++I) {
I->second->setHasPHIKill(true);
- MachineInstrIndex KillIndex = LIs->getMBBEndIdx(I->first);
+ LiveIndex KillIndex = LIs->getMBBEndIdx(I->first);
if (!I->second->isKill(KillIndex))
I->second->addKill(KillIndex);
}
}
- MachineInstrIndex EndIndex;
+ LiveIndex EndIndex;
if (IsIntraBlock) {
EndIndex = LIs->getInstructionIndex(UseI);
EndIndex = LIs->getUseIndex(EndIndex);
@@ -733,7 +733,7 @@
DE = MRI->def_end(); DI != DE; ++DI) {
Defs[(*DI).getParent()].insert(&*DI);
- MachineInstrIndex DefIdx = LIs->getInstructionIndex(&*DI);
+ LiveIndex DefIdx = LIs->getInstructionIndex(&*DI);
DefIdx = LIs->getDefIndex(DefIdx);
assert(DI->getOpcode() != TargetInstrInfo::PHI &&
@@ -769,7 +769,7 @@
// Add ranges for dead defs
for (MachineRegisterInfo::def_iterator DI = MRI->def_begin(LI->reg),
DE = MRI->def_end(); DI != DE; ++DI) {
- MachineInstrIndex DefIdx = LIs->getInstructionIndex(&*DI);
+ LiveIndex DefIdx = LIs->getInstructionIndex(&*DI);
DefIdx = LIs->getDefIndex(DefIdx);
if (LI->liveAt(DefIdx)) continue;
@@ -847,7 +847,7 @@
for (MachineRegisterInfo::reg_iterator I = MRI->reg_begin(CurrLI->reg),
E = MRI->reg_end(); I != E; ++I) {
MachineOperand& MO = I.getOperand();
- MachineInstrIndex InstrIdx = LIs->getInstructionIndex(&*I);
+ LiveIndex InstrIdx = LIs->getInstructionIndex(&*I);
if ((MO.isUse() && NewLI.liveAt(LIs->getUseIndex(InstrIdx))) ||
(MO.isDef() && NewLI.liveAt(LIs->getDefIndex(InstrIdx))))
@@ -875,12 +875,12 @@
bool PreAllocSplitting::Rematerialize(unsigned VReg, VNInfo* ValNo,
MachineInstr* DefMI,
MachineBasicBlock::iterator RestorePt,
- MachineInstrIndex RestoreIdx,
+ LiveIndex RestoreIdx,
SmallPtrSet<MachineInstr*, 4>& RefsInMBB) {
MachineBasicBlock& MBB = *RestorePt->getParent();
MachineBasicBlock::iterator KillPt = BarrierMBB->end();
- MachineInstrIndex KillIdx;
+ LiveIndex KillIdx;
if (!ValNo->isDefAccurate() || DefMI->getParent() == BarrierMBB)
KillPt = findSpillPoint(BarrierMBB, Barrier, NULL, RefsInMBB, KillIdx);
else
@@ -893,7 +893,7 @@
LIs->InsertMachineInstrInMaps(prior(RestorePt), RestoreIdx);
ReconstructLiveInterval(CurrLI);
- MachineInstrIndex RematIdx = LIs->getInstructionIndex(prior(RestorePt));
+ LiveIndex RematIdx = LIs->getInstructionIndex(prior(RestorePt));
RematIdx = LIs->getDefIndex(RematIdx);
RenumberValno(CurrLI->findDefinedVNInfoForRegInt(RematIdx));
@@ -950,7 +950,7 @@
if (CurrSLI->hasAtLeastOneValue())
CurrSValNo = CurrSLI->getValNumInfo(0);
else
- CurrSValNo = CurrSLI->getNextValue(MachineInstrIndex(), 0, false,
+ CurrSValNo = CurrSLI->getNextValue(LiveIndex(), 0, false,
LSs->getVNInfoAllocator());
}
@@ -1060,7 +1060,7 @@
}
// Find a point to restore the value after the barrier.
- MachineInstrIndex RestoreIndex;
+ LiveIndex RestoreIndex;
MachineBasicBlock::iterator RestorePt =
findRestorePoint(BarrierMBB, Barrier, LR->end, RefsInMBB, RestoreIndex);
if (RestorePt == BarrierMBB->end())
@@ -1074,7 +1074,7 @@
// Add a spill either before the barrier or after the definition.
MachineBasicBlock *DefMBB = DefMI ? DefMI->getParent() : NULL;
const TargetRegisterClass *RC = MRI->getRegClass(CurrLI->reg);
- MachineInstrIndex SpillIndex;
+ LiveIndex SpillIndex;
MachineInstr *SpillMI = NULL;
int SS = -1;
if (!ValNo->isDefAccurate()) {
@@ -1152,7 +1152,7 @@
ReconstructLiveInterval(CurrLI);
if (!FoldedRestore) {
- MachineInstrIndex RestoreIdx = LIs->getInstructionIndex(prior(RestorePt));
+ LiveIndex RestoreIdx = LIs->getInstructionIndex(prior(RestorePt));
RestoreIdx = LIs->getDefIndex(RestoreIdx);
RenumberValno(CurrLI->findDefinedVNInfoForRegInt(RestoreIdx));
}
@@ -1240,7 +1240,7 @@
// reaching definition (VNInfo).
for (MachineRegisterInfo::use_iterator UI = MRI->use_begin((*LI)->reg),
UE = MRI->use_end(); UI != UE; ++UI) {
- MachineInstrIndex index = LIs->getInstructionIndex(&*UI);
+ LiveIndex index = LIs->getInstructionIndex(&*UI);
index = LIs->getUseIndex(index);
const LiveRange* LR = (*LI)->getLiveRangeContaining(index);
@@ -1390,7 +1390,7 @@
if (LR->valno->hasPHIKill())
return false;
- MachineInstrIndex MBBEnd = LIs->getMBBEndIdx(BarrierMBB);
+ LiveIndex MBBEnd = LIs->getMBBEndIdx(BarrierMBB);
if (LR->end < MBBEnd)
return false;