15 #define DEBUG_TYPE "regalloc"
32 STATISTIC(NumFinished,
"Number of splits finished");
33 STATISTIC(NumSimple,
"Number of splits that were simple");
34 STATISTIC(NumCopies,
"Number of copies inserted for splitting");
35 STATISTIC(NumRemats,
"Number of rematerialized defs for splitting");
36 STATISTIC(NumRepairs,
"Number of invalid live ranges repaired");
45 : MF(vrm.getMachineFunction()),
49 TII(*MF.getTarget().getInstrInfo()),
51 LastSplitPoint(MF.getNumBlockIDs()) {}
56 ThroughBlocks.
clear();
58 DidRepairRange =
false;
61 SlotIndex SplitAnalysis::computeLastSplitPoint(
unsigned Num) {
64 std::pair<SlotIndex, SlotIndex> &LSP = LastSplitPoint[Num];
69 if (!LSP.first.isValid()) {
71 if (FirstTerm == MBB->
end())
80 LSP.second = LSP.first;
122 void SplitAnalysis::analyzeUses() {
123 assert(UseSlots.empty() &&
"Call clear first");
129 if (!(*I)->isPHIDef() && !(*I)->isUnused())
130 UseSlots.push_back((*I)->def);
137 if (!
I.getOperand().isUndef())
144 UseSlots.erase(std::unique(UseSlots.begin(), UseSlots.end(),
149 if (!calcLiveBlockInfo()) {
152 DidRepairRange =
true;
154 DEBUG(
dbgs() <<
"*** Fixing inconsistent live interval! ***\n");
156 .shrinkToUses(const_cast<LiveInterval*>(CurLI));
158 ThroughBlocks.
clear();
159 bool fixed = calcLiveBlockInfo();
161 assert(fixed &&
"Couldn't fix broken live interval");
165 << UseSlots.size() <<
" instrs in "
166 << UseBlocks.size() <<
" blocks, through "
167 << NumThroughBlocks <<
" blocks.\n");
172 bool SplitAnalysis::calcLiveBlockInfo() {
174 NumThroughBlocks = NumGapBlocks = 0;
182 UseI = UseSlots.begin();
183 UseE = UseSlots.end();
196 if (UseI == UseE || *UseI >= Stop) {
198 ThroughBlocks.
set(BI.MBB->getNumber());
205 BI.FirstInstr = *UseI;
206 assert(BI.FirstInstr >= Start);
208 while (UseI != UseE && *UseI < Stop);
209 BI.LastInstr = UseI[-1];
210 assert(BI.LastInstr < Stop);
213 BI.LiveIn = LVI->start <= Start;
217 assert(LVI->start == LVI->valno->def &&
"Dangling Segment start");
218 assert(LVI->start == BI.FirstInstr &&
"First instr should be a def");
219 BI.FirstDef = BI.FirstInstr;
224 while (LVI->end < Stop) {
226 if (++LVI == LVE || LVI->start >= Stop) {
228 BI.LastInstr = LastStop;
232 if (LastStop < LVI->start) {
239 UseBlocks.push_back(BI);
240 UseBlocks.back().LastInstr = LastStop;
245 BI.FirstInstr = BI.FirstDef = LVI->start;
249 assert(LVI->start == LVI->valno->def &&
"Dangling Segment start");
251 BI.FirstDef = LVI->start;
254 UseBlocks.push_back(BI);
262 if (LVI->end == Stop && ++LVI == LVE)
266 if (LVI->start < Stop)
295 }
while (Stop <= LVI->start);
302 assert(!Orig.
empty() &&
"Splitting empty interval?");
306 if (I != Orig.
end() && I->start <= Idx)
307 return I->start == Idx;
310 return I != Orig.
begin() && (--
I)->
end == Idx;
330 : SA(sa), LIS(lis), VRM(vrm),
331 MRI(vrm.getMachineFunction().getRegInfo()),
333 TII(*vrm.getMachineFunction().getTarget().getInstrInfo()),
334 TRI(*vrm.getMachineFunction().getTarget().getRegisterInfo()),
338 SpillMode(SM_Partition),
361 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
363 if (RegAssign.
empty()) {
364 dbgs() <<
" empty\n";
369 dbgs() <<
" [" <<
I.start() <<
';' <<
I.stop() <<
"):" <<
I.value();
374 VNInfo *SplitEditor::defValue(
unsigned RegIdx,
377 assert(ParentVNI &&
"Mapping NULL value");
378 assert(Idx.
isValid() &&
"Invalid SlotIndex");
386 std::pair<ValueMap::iterator, bool> InsP =
387 Values.
insert(std::make_pair(std::make_pair(RegIdx, ParentVNI->
id),
388 ValueForcePair(VNI,
false)));
396 if (
VNInfo *OldVNI = InsP.first->second.getPointer()) {
400 InsP.first->second = ValueForcePair();
405 LI->addSegment(LiveInterval::Segment(Def, Def.
getDeadSlot(), VNI));
410 void SplitEditor::forceRecompute(
unsigned RegIdx,
const VNInfo *ParentVNI) {
411 assert(ParentVNI &&
"Mapping NULL value");
412 ValueForcePair &VFP = Values[std::make_pair(RegIdx, ParentVNI->
id)];
413 VNInfo *VNI = VFP.getPointer();
428 VFP = ValueForcePair(0,
true);
431 VNInfo *SplitEditor::defFromParent(
unsigned RegIdx,
442 bool Late = RegIdx != 0;
459 return defValue(RegIdx, ParentVNI, Def);
469 OpenIdx = Edit->
size();
475 assert(Idx != 0 &&
"Cannot select the complement interval");
476 assert(Idx < Edit->size() &&
"Can only select previously opened interval");
477 DEBUG(
dbgs() <<
" selectIntv " << OpenIdx <<
" -> " << Idx <<
'\n');
482 assert(OpenIdx &&
"openIntv not called before enterIntvBefore");
483 DEBUG(
dbgs() <<
" enterIntvBefore " << Idx);
490 DEBUG(
dbgs() <<
": valno " << ParentVNI->
id <<
'\n');
492 assert(MI &&
"enterIntvBefore called with invalid index");
499 assert(OpenIdx &&
"openIntv not called before enterIntvAfter");
500 DEBUG(
dbgs() <<
" enterIntvAfter " << Idx);
507 DEBUG(
dbgs() <<
": valno " << ParentVNI->
id <<
'\n');
509 assert(MI &&
"enterIntvAfter called with invalid index");
517 assert(OpenIdx &&
"openIntv not called before enterIntvAtEnd");
526 DEBUG(
dbgs() <<
": valno " << ParentVNI->id);
527 VNInfo *VNI = defFromParent(OpenIdx, ParentVNI, Last, MBB,
529 RegAssign.
insert(VNI->
def, End, OpenIdx);
540 assert(OpenIdx &&
"openIntv not called before useIntv");
541 DEBUG(
dbgs() <<
" useIntv [" << Start <<
';' << End <<
"):");
542 RegAssign.
insert(Start, End, OpenIdx);
547 assert(OpenIdx &&
"openIntv not called before leaveIntvAfter");
548 DEBUG(
dbgs() <<
" leaveIntvAfter " << Idx);
557 DEBUG(
dbgs() <<
": valno " << ParentVNI->
id <<
'\n');
559 assert(MI &&
"No instruction at index");
567 forceRecompute(0, ParentVNI);
568 defFromParent(0, ParentVNI, Idx, *MI->
getParent(),
MI);
578 assert(OpenIdx &&
"openIntv not called before leaveIntvBefore");
579 DEBUG(
dbgs() <<
" leaveIntvBefore " << Idx);
588 DEBUG(
dbgs() <<
": valno " << ParentVNI->
id <<
'\n');
591 assert(MI &&
"No instruction at index");
597 assert(OpenIdx &&
"openIntv not called before leaveIntvAtTop");
607 VNInfo *VNI = defFromParent(0, ParentVNI, Start, MBB,
609 RegAssign.
insert(Start, VNI->
def, OpenIdx);
615 assert(OpenIdx &&
"openIntv not called before overlapIntv");
618 "Parent changes value in extended range");
620 "Range cannot span basic blocks");
624 forceRecompute(0, ParentVNI);
625 DEBUG(
dbgs() <<
" overlapIntv [" << Start <<
';' << End <<
"):");
626 RegAssign.
insert(Start, End, OpenIdx);
636 DEBUG(
dbgs() <<
"Removing " << Copies.
size() <<
" back-copies.\n");
638 AssignI.setMap(RegAssign);
640 for (
unsigned i = 0, e = Copies.
size(); i != e; ++i) {
644 assert(MI &&
"No instruction for back-copy");
649 do AtBegin = MBBI == MBB->
begin();
650 while (!AtBegin && (--MBBI)->isDebugValue());
652 DEBUG(
dbgs() <<
"Removing " << Def <<
'\t' << *MI);
661 if (!AssignI.valid() || AssignI.start() >=
Def)
664 if (AssignI.stop() !=
Def)
666 unsigned RegIdx = AssignI.value();
667 if (AtBegin || !MBBI->readsVirtualRegister(Edit->
getReg())) {
668 DEBUG(
dbgs() <<
" cannot find simple kill of RegIdx " << RegIdx <<
'\n');
672 DEBUG(
dbgs() <<
" move kill to " << Kill <<
'\t' << *MBBI);
673 AssignI.setStop(Kill);
683 assert(MDT.
dominates(DefMBB, MBB) &&
"MBB must be dominated by the def.");
686 const MachineLoop *DefLoop = Loops.getLoopFor(DefMBB);
691 unsigned BestDepth = UINT_MAX;
705 if (Loop == DefLoop) {
707 << MBB->
getNumber() <<
" in the same loop\n");
713 if (Depth < BestDepth) {
717 << MBB->
getNumber() <<
" at depth " << Depth <<
'\n');
725 if (!IDom || !MDT.
dominates(DefDomNode, IDom))
732 void SplitEditor::hoistCopiesForSize() {
739 typedef std::pair<MachineBasicBlock*, SlotIndex> DomPair;
750 assert(ParentVNI &&
"Parent not live at complement def");
758 DomPair &Dom = NearestDom[ParentVNI->
id];
763 if (VNI->
def == ParentVNI->
def) {
764 DEBUG(
dbgs() <<
"Direct complement def at " << VNI->
def <<
'\n');
765 Dom = DomPair(ValMBB, VNI->
def);
770 if (Values.
lookup(std::make_pair(0, ParentVNI->
id)).getPointer()) {
771 DEBUG(
dbgs() <<
"Single complement def at " << VNI->
def <<
'\n');
777 Dom = DomPair(ValMBB, VNI->
def);
778 }
else if (Dom.first == ValMBB) {
780 if (!Dom.second.isValid() || VNI->
def < Dom.second)
781 Dom.second = VNI->
def;
788 Dom = DomPair(ValMBB, VNI->
def);
789 else if (Near != Dom.first)
794 DEBUG(
dbgs() <<
"Multi-mapped complement " << VNI->
id <<
'@' << VNI->
def
795 <<
" for parent " << ParentVNI->
id <<
'@' << ParentVNI->
def
796 <<
" hoist to BB#" << Dom.first->getNumber() <<
' '
797 << Dom.second <<
'\n');
801 for (
unsigned i = 0, e = Parent->
getNumValNums(); i != e; ++i) {
802 DomPair &Dom = NearestDom[i];
803 if (!Dom.first || Dom.second.isValid())
809 Dom.first = findShallowDominator(Dom.first, DefMBB);
812 defFromParent(0, ParentVNI, Last, *Dom.first,
825 const DomPair &Dom = NearestDom[ParentVNI->
id];
826 if (!Dom.first || Dom.second == VNI->
def)
829 forceRecompute(0, ParentVNI);
831 removeBackCopies(BackCopies);
837 bool SplitEditor::transferValues() {
838 bool Skipped =
false;
841 ParentE = Edit->
getParent().
end(); ParentI != ParentE; ++ParentI) {
842 DEBUG(
dbgs() <<
" blit " << *ParentI <<
':');
843 VNInfo *ParentVNI = ParentI->valno;
846 AssignI.advanceTo(Start);
850 if (!AssignI.valid()) {
852 }
else if (AssignI.start() <= Start) {
853 RegIdx = AssignI.value();
854 if (AssignI.stop() < End) {
855 End = AssignI.stop();
860 End = std::min(End, AssignI.start());
864 DEBUG(
dbgs() <<
" [" << Start <<
';' << End <<
")=" << RegIdx);
868 ValueForcePair VFP = Values.
lookup(std::make_pair(RegIdx, ParentVNI->
id));
869 if (
VNInfo *VNI = VFP.getPointer()) {
871 LR.
addSegment(LiveInterval::Segment(Start, End, VNI));
894 if (Start != BlockStart) {
896 assert(VNI &&
"Missing def for complex mapped value");
897 DEBUG(
dbgs() <<
':' << VNI->
id <<
"*BB#" << MBB->getNumber());
904 BlockStart = BlockEnd;
908 assert(Start <= BlockStart &&
"Expected live-in block");
909 while (BlockStart < End) {
910 DEBUG(
dbgs() <<
">BB#" << MBB->getNumber());
912 if (BlockStart == ParentVNI->
def) {
914 assert(ParentVNI->
isPHIDef() &&
"Non-phi defined at block start?");
916 assert(VNI &&
"Missing def for complex mapped parent PHI");
930 BlockStart = BlockEnd;
934 }
while (Start != ParentI->end);
945 void SplitEditor::extendPHIKillRanges() {
952 unsigned RegIdx = RegAssign.
lookup(PHIVNI->
def);
957 PE = MBB->
pred_end(); PI != PE; ++PI) {
963 assert(RegAssign.
lookup(LastUse) == RegIdx &&
964 "Different register assignment in phi predecessor");
972 void SplitEditor::rewriteAssigned(
bool ExtendRanges) {
974 RE = MRI.
reg_end(); RI != RE;) {
993 unsigned RegIdx = RegAssign.
lookup(Idx);
997 << Idx <<
':' << RegIdx <<
'\t' << *
MI);
1000 if (!ExtendRanges || MO.
isUndef())
1019 void SplitEditor::deleteRematVictims() {
1024 LII != LIE; ++LII) {
1026 if (LII->end != LII->valno->def.getDeadSlot())
1029 assert(MI &&
"Missing instruction for dead def");
1035 DEBUG(
dbgs() <<
"All defs dead: " << *MI);
1058 unsigned RegIdx = RegAssign.
lookup(ParentVNI->
def);
1059 defValue(RegIdx, ParentVNI, ParentVNI->
def);
1064 for (
unsigned i = 0, e = Edit->
size(); i != e; ++i)
1065 forceRecompute(i, ParentVNI);
1069 switch (SpillMode) {
1074 hoistCopiesForSize();
1081 bool Skipped = transferValues();
1083 extendPHIKillRanges();
1088 rewriteAssigned(Skipped);
1092 deleteRematVictims();
1103 for (
unsigned i = 0, e = Edit->
size(); i != e; ++i)
1109 for (
unsigned i = 0, e = Edit->
size(); i != e; ++i) {
1112 unsigned NumComp = ConEQ.
Classify(li);
1115 DEBUG(
dbgs() <<
" " << NumComp <<
" components: " << *li <<
'\n');
1118 for (
unsigned j = 1; j != NumComp; ++j)
1129 assert(!LRMap || LRMap->
size() == Edit->
size());
1138 bool SingleInstrs)
const {
1184 unsigned IntvOut,
SlotIndex EnterAfter){
1188 DEBUG(
dbgs() <<
"BB#" << MBBNum <<
" [" << Start <<
';' << Stop
1189 <<
") intf " << LeaveBefore <<
'-' << EnterAfter
1190 <<
", live-through " << IntvIn <<
" -> " << IntvOut);
1192 assert((IntvIn || IntvOut) &&
"Use splitSingleBlock for isolated blocks");
1194 assert((!LeaveBefore || LeaveBefore < Stop) &&
"Interference after block");
1195 assert((!IntvIn || !LeaveBefore || LeaveBefore > Start) &&
"Impossible intf");
1196 assert((!EnterAfter || EnterAfter >= Start) &&
"Interference before block");
1209 assert((!LeaveBefore || Idx <= LeaveBefore) &&
"Interference");
1223 assert((!EnterAfter || Idx >= EnterAfter) &&
"Interference");
1228 if (IntvIn == IntvOut && !LeaveBefore && !EnterAfter) {
1229 DEBUG(
dbgs() <<
", straight through.\n");
1241 assert((!IntvOut || !EnterAfter || EnterAfter < LSP) &&
"Impossible intf");
1243 if (IntvIn != IntvOut && (!LeaveBefore || !EnterAfter ||
1245 DEBUG(
dbgs() <<
", switch avoiding interference.\n");
1253 if (LeaveBefore && LeaveBefore < LSP) {
1261 assert((!LeaveBefore || Idx <= LeaveBefore) &&
"Interference");
1262 assert((!EnterAfter || Idx >= EnterAfter) &&
"Interference");
1266 DEBUG(
dbgs() <<
", create local intv for interference.\n");
1272 assert(LeaveBefore <= EnterAfter &&
"Missed case");
1277 assert((!EnterAfter || Idx >= EnterAfter) &&
"Interference");
1282 assert((!LeaveBefore || Idx <= LeaveBefore) &&
"Interference");
1287 unsigned IntvIn,
SlotIndex LeaveBefore) {
1293 <<
", reg-in " << IntvIn <<
", leave before " << LeaveBefore
1294 << (BI.
LiveOut ?
", stack-out" :
", killed in block"));
1296 assert(IntvIn &&
"Must have register in");
1297 assert(BI.
LiveIn &&
"Must be live-in");
1298 assert((!LeaveBefore || LeaveBefore > Start) &&
"Bad interference");
1301 DEBUG(
dbgs() <<
" before interference.\n");
1326 DEBUG(
dbgs() <<
", spill after last use before interference.\n");
1330 assert((!LeaveBefore || Idx <= LeaveBefore) &&
"Interference");
1332 DEBUG(
dbgs() <<
", spill before last split point.\n");
1337 assert((!LeaveBefore || Idx <= LeaveBefore) &&
"Interference");
1347 DEBUG(
dbgs() <<
", creating local interval " << LocalIntv <<
".\n");
1360 assert((!LeaveBefore || From <= LeaveBefore) &&
"Interference");
1375 assert((!LeaveBefore || From <= LeaveBefore) &&
"Interference");
1379 unsigned IntvOut,
SlotIndex EnterAfter) {
1385 <<
", reg-out " << IntvOut <<
", enter after " << EnterAfter
1386 << (BI.
LiveIn ?
", stack-in" :
", defined in block"));
1390 assert(IntvOut &&
"Must have register out");
1391 assert(BI.
LiveOut &&
"Must be live-out");
1392 assert((!EnterAfter || EnterAfter < LSP) &&
"Bad interference");
1395 DEBUG(
dbgs() <<
" after interference.\n");
1407 DEBUG(
dbgs() <<
", reload after interference.\n");
1416 assert((!EnterAfter || Idx >= EnterAfter) &&
"Interference");
1423 DEBUG(
dbgs() <<
", interference overlaps uses.\n");
1432 assert((!EnterAfter || Idx >= EnterAfter) &&
"Interference");
void resize(unsigned N, bool t=false)
resize - Grow or shrink the bitvector.
ValT lookup(KeyT x, ValT NotFound=ValT()) const
lookup - Return the mapped value at x or NotFound.
void push_back(const T &Elt)
const_iterator end(StringRef path)
Get end iterator over path.
MachineInstr * getParent()
const_iterator begin() const
void extend(LiveRange &LR, SlotIndex Kill, unsigned PhysReg=0)
SlotIndex def
The index of the defining instruction.
bool anyRematerializable(AliasAnalysis *)
SlotIndex getBoundaryIndex() const
MachineFunction & getMachineFunction() const
void reset(LiveRangeEdit &, ComplementSpillMode=SM_Partition)
reset - Prepare for a new split.
SlotIndex getBaseIndex() const
bool addRegisterDead(unsigned Reg, const TargetRegisterInfo *RegInfo, bool AddIfNotFound=false)
SlotIndex getLastSplitPoint(unsigned Num)
void setLiveOutValue(MachineBasicBlock *MBB, VNInfo *VNI)
void finish(SmallVectorImpl< unsigned > *LRMap=0)
iterator getFirstTerminator()
SlotIndex getInstructionIndex(const MachineInstr *instr) const
Returns the base index of the given instruction.
iterator advanceTo(iterator I, SlotIndex Pos)
MachineBasicBlock * getMBBFromIndex(SlotIndex index) const
SplitEditor(SplitAnalysis &SA, LiveIntervals &, VirtRegMap &, MachineDominatorTree &, MachineBlockFrequencyInfo &)
Create a new SplitEditor for editing the LiveInterval analyzed by SA.
SlotIndex getMBBEndIdx(const MachineBasicBlock *mbb) const
Return the last index in the given basic block.
bool isLiveInToMBB(const LiveRange &LR, const MachineBasicBlock *mbb) const
bool readsVirtualRegister(unsigned Reg) const
const MachineLoopInfo & Loops
STATISTIC(NumFinished,"Number of splits finished")
SplitAnalysis(const VirtRegMap &vrm, const LiveIntervals &lis, const MachineLoopInfo &mli)
friend class const_iterator
SlotIndex enterIntvAtEnd(MachineBasicBlock &MBB)
bool didRematerialize(const VNInfo *ParentVNI) const
didRematerialize - Return true if ParentVNI was rematerialized anywhere.
unsigned getNumValNums() const
void splitRegInBlock(const SplitAnalysis::BlockInfo &BI, unsigned IntvIn, SlotIndex LeaveBefore)
static use_nodbg_iterator use_nodbg_end()
VNInfo * getVNInfoAt(SlotIndex Idx) const
getVNInfoAt - Return the VNInfo that is live at Idx, or NULL.
BlockT * getHeader() const
LoopInfoBase< BlockT, LoopT > * LI
bool allDefsAreDead() const
static bool isEarlierInstr(SlotIndex A, SlotIndex B)
void analyze(const LiveInterval *li)
void clear()
clear - Clear all bits.
unsigned getNumBlockIDs() const
void splitSingleBlock(const SplitAnalysis::BlockInfo &BI)
const HexagonInstrInfo * TII
#define llvm_unreachable(msg)
VNInfo::Allocator & getVNInfoAllocator()
SmallVectorImpl< unsigned >::const_iterator iterator
Iterator for accessing the new registers added by this edit.
unsigned Classify(const LiveInterval *LI)
void overlapIntv(SlotIndex Start, SlotIndex End)
SlotIndex getDeadSlot() const
Returns the dead def kill slot for the current instruction.
unsigned openIntv()
Create a new virtual register and live interval.
bool isUnused() const
Returns true if this value is unused.
bool shouldSplitSingleBlock(const BlockInfo &BI, bool SingleInstrs) const
void Distribute(LiveInterval *LIV[], MachineRegisterInfo &MRI)
bool empty() const
empty - Return true when no intervals are mapped.
SlotIndex leaveIntvAfter(SlotIndex Idx)
void addLiveInBlock(LiveRange &LR, MachineDomTreeNode *DomNode, SlotIndex Kill=SlotIndex())
MachineBasicBlock::iterator getLastSplitPointIter(MachineBasicBlock *)
getLastSplitPointIter - Returns the last split point as an iterator.
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
iterator addSegment(Segment S)
void clear()
clear - Remove all entries.
const LiveIntervals & LIS
std::vector< MachineBasicBlock * >::iterator pred_iterator
MachineBasicBlock * findNearestCommonDominator(MachineBasicBlock *A, MachineBasicBlock *B)
VNInfoList::const_iterator const_vni_iterator
SlotIndex LastInstr
Last instr accessing current reg.
unsigned get(unsigned idx) const
SlotIndex getPrevSlot() const
const MachineBasicBlock * getParent() const
bool isDebugValue() const
bool isEarlyClobber() const
void reset(const MachineFunction *MF, SlotIndexes *, MachineDominatorTree *, VNInfo::Allocator *)
bundle_iterator< MachineInstr, instr_iterator > iterator
void removeValNo(VNInfo *ValNo)
void RemoveMachineInstrFromMaps(MachineInstr *MI)
void array_pod_sort(IteratorTy Start, IteratorTy End)
SlotIndexes * getSlotIndexes() const
iterator SkipPHIsAndLabels(iterator I)
void useIntv(const MachineBasicBlock &MBB)
useIntv - indicate that all instructions in MBB should use OpenLI.
unsigned getOriginal(unsigned VirtReg) const
ItTy next(ItTy it, Dist n)
const MachineBasicBlock * getLandingPadSuccessor() const
bool canRematerializeAt(Remat &RM, SlotIndex UseIdx, bool cheapAsAMove)
LiveInterval & getParent() const
SlotIndex leaveIntvAtTop(MachineBasicBlock &MBB)
MachineInstrBuilder BuildMI(MachineFunction &MF, DebugLoc DL, const MCInstrDesc &MCID)
unsigned getSubReg() const
void selectIntv(unsigned Idx)
selectIntv - Select a previously opened interval index.
pred_iterator pred_begin()
bool liveAt(SlotIndex index) const
VNInfoList::iterator vni_iterator
const MCInstrDesc & get(unsigned Opcode) const
void insert(KeyT a, KeyT b, ValT y)
void splitRegOutBlock(const SplitAnalysis::BlockInfo &BI, unsigned IntvOut, SlotIndex EnterAfter)
iterator find(SlotIndex Pos)
unsigned id
The ID number of this value.
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
Segments::const_iterator const_iterator
static bool isSameInstr(SlotIndex A, SlotIndex B)
isSameInstr - Return true if A and B refer to the same instruction.
const MachineFunction & MF
unsigned getNumLiveBlocks() const
getNumLiveBlocks - Return the number of blocks where CurLI is live.
SlotIndex FirstInstr
First instr accessing current reg.
SlotIndex leaveIntvBefore(SlotIndex Idx)
MachineBasicBlock * getBlockNumbered(unsigned N) const
LiveInterval & getInterval(unsigned Reg)
raw_ostream & dbgs()
dbgs - Return a circular-buffered debug stream.
bool LiveOut
Current reg is live out.
VNInfo * getValNumInfo(unsigned ValNo)
void splitLiveThroughBlock(unsigned MBBNum, unsigned IntvIn, SlotIndex LeaveBefore, unsigned IntvOut, SlotIndex EnterAfter)
bundle_iterator< const MachineInstr, const_instr_iterator > const_iterator
SlotIndex rematerializeAt(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned DestReg, const Remat &RM, const TargetRegisterInfo &, bool Late=false)
MachineRegisterInfo & getRegInfo()
void setReg(unsigned Reg)
SlotIndex enterIntvBefore(SlotIndex Idx)
VNInfo * extendInBlock(SlotIndex StartIdx, SlotIndex Kill)
Remat - Information needed to rematerialize at a specific location.
SlotIndex getRegSlot(bool EC=false) const
void eliminateDeadDefs(SmallVectorImpl< MachineInstr * > &Dead, ArrayRef< unsigned > RegsBeingSpilled=None)
unsigned countLiveBlocks(const LiveInterval *li) const
ValueT lookup(const KeyT &Val) const
MachineInstr * getInstructionFromIndex(SlotIndex index) const
Returns the instruction associated with the given index.
LiveInterval & createEmptyInterval()
BasicBlockListType::iterator iterator
SlotIndex getMBBStartIdx(const MachineBasicBlock *mbb) const
Return the first index in the given basic block.
void calculateRegClassAndHint(MachineFunction &, const MachineLoopInfo &, const MachineBlockFrequencyInfo &)
reg_iterator reg_begin(unsigned RegNo) const
const MCRegisterInfo & MRI
SlotIndex enterIntvAfter(SlotIndex Idx)
SlotIndex getNextSlot() const
static reg_iterator reg_end()
bool LiveIn
Current reg is live in.
bool dominates(const MachineDomTreeNode *A, const MachineDomTreeNode *B) const
SlotIndex - An opaque wrapper around machine indexes.
void dump() const
dump - print the current interval maping to dbgs().
SlotIndex insertMachineInstrInMaps(MachineInstr *mi, bool Late=false)
unsigned getLoopDepth() const
tier< T1, T2 > tie(T1 &f, T2 &s)
bool isOriginalEndpoint(SlotIndex Idx) const
use_nodbg_iterator use_nodbg_begin(unsigned RegNo) const
VNInfo * getVNInfoBefore(SlotIndex Idx) const
const std::pair< SlotIndex, SlotIndex > & getMBBRange(unsigned Num) const
Return the (start,end) range of the given basic block number.