static char ID; // Pass identification, replacement for typeid
LiveIntervals() : MachineFunctionPass(&ID) {}
- static MachineInstrIndex getBaseIndex(MachineInstrIndex index) {
+ MachineInstrIndex getBaseIndex(MachineInstrIndex index) {
return MachineInstrIndex(index, MachineInstrIndex::LOAD);
}
- static MachineInstrIndex getBoundaryIndex(MachineInstrIndex index) {
+ MachineInstrIndex getBoundaryIndex(MachineInstrIndex index) {
return MachineInstrIndex(index,
(MachineInstrIndex::Slot)(MachineInstrIndex::NUM - 1));
}
- static MachineInstrIndex getLoadIndex(MachineInstrIndex index) {
+ MachineInstrIndex getLoadIndex(MachineInstrIndex index) {
return MachineInstrIndex(index, MachineInstrIndex::LOAD);
}
- static MachineInstrIndex getUseIndex(MachineInstrIndex index) {
+ MachineInstrIndex getUseIndex(MachineInstrIndex index) {
return MachineInstrIndex(index, MachineInstrIndex::USE);
}
- static MachineInstrIndex getDefIndex(MachineInstrIndex index) {
+ MachineInstrIndex getDefIndex(MachineInstrIndex index) {
return MachineInstrIndex(index, MachineInstrIndex::DEF);
}
- static MachineInstrIndex getStoreIndex(MachineInstrIndex index) {
+ MachineInstrIndex getStoreIndex(MachineInstrIndex index) {
return MachineInstrIndex(index, MachineInstrIndex::STORE);
}
+
+
MachineInstrIndex getNextSlot(MachineInstrIndex m) const {
return m.nextSlot();
}
// Once we've found it, extend its VNInfo to our instruction.
MachineInstrIndex DefIndex = LIs->getInstructionIndex(Walker);
- DefIndex = LiveIntervals::getDefIndex(DefIndex);
+ DefIndex = LIs->getDefIndex(DefIndex);
MachineInstrIndex EndIndex = LIs->getMBBEndIdx(MBB);
RetVNI = NewVNs[Walker];
}
MachineInstrIndex UseIndex = LIs->getInstructionIndex(Walker);
- UseIndex = LiveIntervals::getUseIndex(UseIndex);
+ UseIndex = LIs->getUseIndex(UseIndex);
MachineInstrIndex EndIndex;
if (IsIntraBlock) {
EndIndex = LIs->getInstructionIndex(UseI);
- EndIndex = LiveIntervals::getUseIndex(EndIndex);
+ EndIndex = LIs->getUseIndex(EndIndex);
} else
EndIndex = LIs->getMBBEndIdx(MBB);
}
MachineInstrIndex StartIndex = LIs->getInstructionIndex(Walker);
- StartIndex = foundDef ? LiveIntervals::getDefIndex(StartIndex) :
- LiveIntervals::getUseIndex(StartIndex);
+ StartIndex = foundDef ? LIs->getDefIndex(StartIndex) :
+ LIs->getUseIndex(StartIndex);
MachineInstrIndex EndIndex;
if (IsIntraBlock) {
EndIndex = LIs->getInstructionIndex(UseI);
- EndIndex = LiveIntervals::getUseIndex(EndIndex);
+ EndIndex = LIs->getUseIndex(EndIndex);
} else
EndIndex = LIs->getMBBEndIdx(MBB);
MachineInstrIndex EndIndex;
if (IsIntraBlock) {
EndIndex = LIs->getInstructionIndex(UseI);
- EndIndex = LiveIntervals::getUseIndex(EndIndex);
+ EndIndex = LIs->getUseIndex(EndIndex);
} else
EndIndex = LIs->getMBBEndIdx(MBB);
LI->addRange(LiveRange(StartIndex, LIs->getNextSlot(EndIndex), RetVNI));
Defs[(*DI).getParent()].insert(&*DI);
MachineInstrIndex DefIdx = LIs->getInstructionIndex(&*DI);
- DefIdx = LiveIntervals::getDefIndex(DefIdx);
+ DefIdx = LIs->getDefIndex(DefIdx);
assert(DI->getOpcode() != TargetInstrInfo::PHI &&
"Following NewVN isPHIDef flag incorrect. Fix me!");
for (MachineRegisterInfo::def_iterator DI = MRI->def_begin(LI->reg),
DE = MRI->def_end(); DI != DE; ++DI) {
MachineInstrIndex DefIdx = LIs->getInstructionIndex(&*DI);
- DefIdx = LiveIntervals::getDefIndex(DefIdx);
+ DefIdx = LIs->getDefIndex(DefIdx);
if (LI->liveAt(DefIdx)) continue;
if (DefIdx == ~0U) continue;
if (MI->isRegTiedToUseOperand(DefIdx)) {
VNInfo* NextVN =
- CurrLI->findDefinedVNInfoForRegInt(
- LiveIntervals::getDefIndex(*KI));
+ CurrLI->findDefinedVNInfoForRegInt(LIs->getDefIndex(*KI));
if (NextVN == OldVN) continue;
Stack.push_back(NextVN);
}
MachineOperand& MO = I.getOperand();
MachineInstrIndex InstrIdx = LIs->getInstructionIndex(&*I);
- if ((MO.isUse() && NewLI.liveAt(LiveIntervals::getUseIndex(InstrIdx))) ||
- (MO.isDef() && NewLI.liveAt(LiveIntervals::getDefIndex(InstrIdx))))
+ if ((MO.isUse() && NewLI.liveAt(LIs->getUseIndex(InstrIdx))) ||
+ (MO.isDef() && NewLI.liveAt(LIs->getDefIndex(InstrIdx))))
OpsToChange.push_back(std::make_pair(&*I, I.getOperandNo()));
}
ReconstructLiveInterval(CurrLI);
MachineInstrIndex RematIdx = LIs->getInstructionIndex(prior(RestorePt));
- RematIdx = LiveIntervals::getDefIndex(RematIdx);
+ RematIdx = LIs->getDefIndex(RematIdx);
RenumberValno(CurrLI->findDefinedVNInfoForRegInt(RematIdx));
++NumSplits;
if (!FoldedRestore) {
MachineInstrIndex RestoreIdx = LIs->getInstructionIndex(prior(RestorePt));
- RestoreIdx = LiveIntervals::getDefIndex(RestoreIdx);
+ RestoreIdx = LIs->getDefIndex(RestoreIdx);
RenumberValno(CurrLI->findDefinedVNInfoForRegInt(RestoreIdx));
}
for (MachineRegisterInfo::use_iterator UI = MRI->use_begin((*LI)->reg),
UE = MRI->use_end(); UI != UE; ++UI) {
MachineInstrIndex index = LIs->getInstructionIndex(&*UI);
- index = LiveIntervals::getUseIndex(index);
+ index = LIs->getUseIndex(index);
const LiveRange* LR = (*LI)->getLiveRangeContaining(index);
VNUseCount[LR->valno].insert(&*UI);
if (RegHandled.insert(I->first).second) {
LiveInterval& Int = LI.getOrCreateInterval(I->first);
MachineInstrIndex instrIdx = LI.getInstructionIndex(I->second);
- if (Int.liveAt(LiveIntervals::getDefIndex(instrIdx)))
- Int.removeRange(LiveIntervals::getDefIndex(instrIdx),
+ if (Int.liveAt(LI.getDefIndex(instrIdx)))
+ Int.removeRange(LI.getDefIndex(instrIdx),
LI.getNextSlot(LI.getMBBEndIdx(I->second->getParent())),
true);
LiveRange R = LI.addLiveRangeToEndOfBlock(I->first, I->second);
R.valno->setCopy(I->second);
- R.valno->def =
- LiveIntervals::getDefIndex(LI.getInstructionIndex(I->second));
+ R.valno->def = LI.getDefIndex(LI.getInstructionIndex(I->second));
}
}
}
// Remove the live range for the old vreg.
LiveInterval& OldInt = LI.getInterval(I->getOperand(i).getReg());
LiveInterval::iterator OldLR = OldInt.FindLiveRangeContaining(
- LiveIntervals::getUseIndex(LI.getInstructionIndex(I)));
+ LI.getUseIndex(LI.getInstructionIndex(I)));
if (OldLR != OldInt.end())
OldInt.removeRange(*OldLR, true);
FirstVN->setHasPHIKill(false);
if (I->getOperand(i).isKill())
FirstVN->addKill(
- LiveIntervals::getUseIndex(LI.getInstructionIndex(I)));
+ LI.getUseIndex(LI.getInstructionIndex(I)));
LiveRange LR (LI.getMBBStartIdx(I->getParent()),
LI.getNextSlot(LI.getUseIndex(LI.getInstructionIndex(I))),
LiveInterval& Int = LI.getOrCreateInterval(I->first);
MachineInstrIndex instrIdx =
LI.getInstructionIndex(--SI->second->getFirstTerminator());
- if (Int.liveAt(LiveIntervals::getDefIndex(instrIdx)))
- Int.removeRange(LiveIntervals::getDefIndex(instrIdx),
+ if (Int.liveAt(LI.getDefIndex(instrIdx)))
+ Int.removeRange(LI.getDefIndex(instrIdx),
LI.getNextSlot(LI.getMBBEndIdx(SI->second)), true);
LiveRange R = LI.addLiveRangeToEndOfBlock(I->first,
--SI->second->getFirstTerminator());
R.valno->setCopy(--SI->second->getFirstTerminator());
- R.valno->def = LiveIntervals::getDefIndex(instrIdx);
+ R.valno->def = LI.getDefIndex(instrIdx);
DEBUG(errs() << "Renaming failed: " << SI->first << " -> "
<< I->first << "\n");