40#include "llvm/Config/llvm-config.h"
61#define DEBUG_TYPE "regalloc"
64 "Number of intervals removed for unreferenced virtual registers");
80 OS <<
"Live intervals for machine function: " << MF.
getName() <<
":\n";
88 "Live Interval Analysis",
false,
false)
105 cl::desc(
"Eagerly compute live intervals for all physreg units."));
127 MachineFunctionAnalysisManager::Invalidator &Inv) {
139void LiveIntervals::clear() {
141 for (
unsigned i = 0, e = VirtRegIntervals.size(); i != e; ++i) {
145 VirtRegIntervals.clear();
146 RegMaskSlots.clear();
148 RegMaskBlocks.
clear();
149 ShrinkBlocks.
clear();
155 RegUnitRanges.clear();
157 IntervalRecycler.clear(RangeAllocator);
158 RegUnitRangeRecycler.clear(RangeAllocator);
159 RangeAllocator.Reset();
162 VNInfoAllocator.Reset();
168 TRI = MF->getSubtarget().getRegisterInfo();
169 TII = MF->getSubtarget().getInstrInfo();
172 LICalc = std::make_unique<LiveIntervalCalc>();
175 VirtRegIntervals.resize(MRI->getNumVirtRegs());
176 ShrinkBlocks.assign(MF->getNumBlockIDs(), {});
180 computeLiveInRegUnits();
185 for (MCRegUnit Unit : TRI->regunits())
191 unsigned Removed = 0;
192 for (
unsigned I = 0, E = MRI->getNumVirtRegs();
I != E; ++
I) {
199 NumUnreferencedIntervals += Removed;
204 OS <<
"********** INTERVALS **********\n";
207 for (
unsigned Unit = 0, UnitE = RegUnitRanges.size(); Unit != UnitE; ++Unit)
209 OS << printRegUnit(static_cast<MCRegUnit>(Unit), TRI) <<
' ' << *LR
213 for (
unsigned i = 0, e = MRI->getNumVirtRegs(); i != e; ++i) {
227void LiveIntervals::printInstrs(
raw_ostream &OS)
const {
228 OS <<
"********** MACHINEINSTRS **********\n";
229 MF->
print(OS, Indexes);
232#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
238#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
244 return new (IntervalRecycler.Allocate(RangeAllocator))
248LiveRange *LiveIntervals::createRegUnitRange() {
249 return new (RegUnitRangeRecycler.Allocate(RangeAllocator))
LiveRange();
253bool LiveIntervals::computeVirtRegInterval(
LiveInterval &LI) {
254 assert(LICalc &&
"LICalc not initialized.");
255 assert(LI.
empty() &&
"Should only compute empty intervals.");
257 LICalc->calculate(LI, MRI->shouldTrackSubRegLiveness(LI.
reg()));
258 return computeDeadValues(LI,
nullptr);
261void LiveIntervals::computeVirtRegs() {
262 for (
unsigned i = 0, e = MRI->getNumVirtRegs(); i != e; ++i) {
264 if (MRI->reg_nodbg_empty(
Reg))
267 bool NeedSplit = computeVirtRegInterval(LI);
275void LiveIntervals::computeRegMasks() {
276 RegMaskBlocks.resize(MF->getNumBlockIDs());
279 for (
const MachineBasicBlock &
MBB : *MF) {
280 std::pair<unsigned, unsigned> &RMB = RegMaskBlocks[
MBB.
getNumber()];
281 RMB.first = RegMaskSlots.size();
285 RegMaskSlots.push_back(Indexes->getMBBStartIdx(&
MBB));
286 RegMaskBits.push_back(Mask);
293 if (
auto *Mask = TRI->getCustomEHPadPreservedMask(*
MBB.
getParent())) {
294 RegMaskSlots.push_back(Indexes->getMBBStartIdx(&
MBB));
295 RegMaskBits.push_back(Mask);
298 for (
const MachineInstr &
MI :
MBB) {
299 for (
const MachineOperand &MO :
MI.operands()) {
302 RegMaskSlots.push_back(Indexes->getInstructionIndex(
MI).getRegSlot());
303 RegMaskBits.push_back(MO.getRegMask());
312 RegMaskSlots.push_back(
313 Indexes->getInstructionIndex(
MBB.
back()).getRegSlot());
314 RegMaskBits.push_back(Mask);
318 RMB.second = RegMaskSlots.size() - RMB.first;
324 assert(&Orig != &SplitBB &&
"expected distinct blocks");
325 std::pair<unsigned, unsigned> &OrigRMB = RegMaskBlocks[Orig.
getNumber()];
326 std::pair<unsigned, unsigned> &SplitRMB = RegMaskBlocks[SplitBB.
getNumber()];
334 if (KeptCount == OrigRMB.second)
337 SplitRMB.first = OrigRMB.first + KeptCount;
338 SplitRMB.second = OrigRMB.second - KeptCount;
339 OrigRMB.second = KeptCount;
342void LiveIntervals::insertMBBInMapsImpl(
344#ifdef EXPENSIVE_CHECKS
345 assert((!AssumeRegMaskEmpty ||
347 [](
const MachineInstr &
MI) {
348 return any_of(
MI.operands(), [](
const MachineOperand &MO) {
349 return MO.isRegMask();
352 "insertMBBInMaps expects a block with no regmask operands; use "
353 "LiveIntervals::splitAt() to split a block containing calls");
355 Indexes->insertMBBInMaps(
MBB);
357 "Blocks must be added in order.");
358 RegMaskBlocks.push_back(std::make_pair(RegMaskSlots.size(), 0));
359 ShrinkBlocks.emplace_back();
376void LiveIntervals::computeRegUnitRange(
LiveRange &LR, MCRegUnit Unit) {
377 assert(LICalc &&
"LICalc not initialized.");
385 bool IsReserved =
false;
387 for (MCRegUnitRootIterator Root(Unit, TRI); Root.isValid(); ++Root) {
388 bool IsRootReserved =
true;
390 for (
const MachineOperand &MO : MRI->def_operands(
Reg))
391 DefIdxs.
push_back(Indexes->getInstructionIndex(*MO.getParent())
392 .getRegSlot(MO.isEarlyClobber()));
395 if (!MRI->isReserved(
Reg))
396 IsRootReserved =
false;
398 IsReserved |= IsRootReserved;
400 assert(IsReserved == MRI->isReservedRegUnit(Unit) &&
401 "reserved computation mismatch");
404 for (SlotIndex DefIdx : DefIdxs)
410 for (MCRegUnitRootIterator Root(Unit, TRI); Root.isValid(); ++Root) {
412 if (!MRI->reg_empty(
Reg))
413 LICalc->extendToUses(LR,
Reg);
422void LiveIntervals::computeLiveInRegUnits() {
423 RegUnitRanges.resize(TRI->getNumRegUnits());
424 LLVM_DEBUG(
dbgs() <<
"Computing live-in reg-units in ABI blocks.\n");
430 for (
const MachineBasicBlock &
MBB : *MF) {
436 SlotIndex Begin = Indexes->getMBBStartIdx(&
MBB);
439 for (MCRegUnit Unit : TRI->regunits(LI.PhysReg)) {
442 LR = RegUnitRanges[
static_cast<unsigned>(
Unit)] =
443 createRegUnitRange();
456 for (MCRegUnit Unit : NewRanges)
457 computeRegUnitRange(*RegUnitRanges[
static_cast<unsigned>(Unit)], Unit);
462 for (
VNInfo *VNI : VNIs) {
471 return A.start < B.start;
475void LiveIntervals::extendSegmentsToUses(
LiveRange &Segments,
476 ShrinkToUsesWorkList &WorkList,
479 SmallPtrSet<VNInfo*, 8> UsedPHIs;
481 if (++ShrinkTag == 0) {
482 ShrinkBlocks.assign(ShrinkBlocks.size(), {});
486 auto getSubRange = [](
const LiveInterval &
I, LaneBitmask
M)
490 for (
const LiveInterval::SubRange &SR :
I.subranges()) {
491 if ((SR.LaneMask & M).any()) {
492 assert(SR.LaneMask == M &&
"Expecting lane masks to match exactly");
500 const LiveRange &OldRange = getSubRange(LI, LaneMask);
507 while (!WorkList.empty()) {
508 SlotIndex
Idx = WorkList.back().first;
509 VNInfo *VNI = WorkList.back().second;
511 const MachineBasicBlock *
MBB = Indexes->getMBBFromIndex(
Idx.getPrevSlot());
512 SlotIndex BlockStart = Indexes->getMBBStartIdx(
MBB);
517 Segments, [Idx](
const LiveRange::Segment &S) {
return S.
start <
Idx; });
518 if (Def !=
Segments.begin() && (--Def)->start >= BlockStart) {
519 assert(
Def->valno == VNI &&
"Unexpected existing value number");
520 Def->end = std::max(
Def->end, Idx);
523 !UsedPHIs.
insert(VNI).second)
527 unsigned &
Tag = ShrinkBlocks[
Pred->getNumber()].LiveOutTag;
528 if (
Tag == ShrinkTag)
531 SlotIndex Stop = Indexes->getMBBEndIdx(
Pred);
534 WorkList.push_back(std::make_pair(Stop, PVNI));
540 if (BS.LiveInTag == ShrinkTag) {
541 LiveRange::Segment &S = LiveIns[BS.LiveIn];
542 assert(S.
valno == VNI &&
"Unexpected existing value number");
543 S.
end = std::max(S.
end, Idx);
547 BS.LiveInTag = ShrinkTag;
548 BS.LiveIn = LiveIns.
size();
552 LiveIns.
push_back(LiveRange::Segment(BlockStart, Idx, VNI));
556 unsigned &
Tag = ShrinkBlocks[
Pred->getNumber()].LiveOutTag;
557 if (
Tag == ShrinkTag)
560 SlotIndex Stop = Indexes->getMBBEndIdx(
Pred);
563 assert(OldVNI == VNI &&
"Wrong value out of predecessor");
565 WorkList.push_back(std::make_pair(Stop, VNI));
573 "Missing value out of predecessor for subrange");
580 [](
const LiveRange::Segment &
A,
const LiveRange::Segment &
B) {
581 return A.start <
B.start;
594 SubRangeUseList
Uses;
595 collectSubRangeUses(li->
reg(),
Uses);
596 bool NeedsCleanup =
false;
598 if ((S.LaneMask & SubRangeMask).none())
600 shrinkSubRangeToUses(S, li->
reg(),
Uses);
610 ShrinkToUsesWorkList WorkList;
615 if (
UseMI.isDebugInstr() || !
UseMI.readsVirtualRegister(Reg))
626 <<
"Warning: Instr claims to read non-existent value in "
635 WorkList.
push_back(std::make_pair(Idx, VNI));
647 bool CanSeparate = computeDeadValues(*li, dead);
654 bool MayHaveSplitComponents =
false;
661 assert(
I != LI.
end() &&
"Missing segment for VNI");
666 if (
MRI->shouldTrackSubRegLiveness(VReg)) {
667 if ((
I == LI.
begin() || std::prev(
I)->end < Def) && !VNI->
isPHIDef()) {
669 MI->setRegisterDefReadUndef(VReg);
673 if (
I->end !=
Def.getDeadSlot())
679 LLVM_DEBUG(
dbgs() <<
"Dead PHI at " << Def <<
" may separate interval\n");
683 assert(
MI &&
"No instruction defining live value");
684 MI->addRegisterDead(LI.
reg(), TRI);
686 if (dead &&
MI->allDefsAreDead()) {
691 MayHaveSplitComponents =
true;
693 return MayHaveSplitComponents;
697 SubRangeUseList
Uses;
698 collectSubRangeUses(Reg,
Uses);
699 shrinkSubRangeToUses(SR, Reg,
Uses);
702void LiveIntervals::collectSubRangeUses(
Register Reg,
703 SubRangeUseList &
Uses)
const {
708 unsigned SubReg = MO.getSubReg();
713 if (!
Uses.empty() &&
Uses.back().first == Idx) {
714 Uses.back().second |= LaneMask;
717 Uses.emplace_back(Idx, LaneMask);
727 ShrinkToUsesWorkList WorkList;
729 for (
const SubRangeUse &Use :
Uses) {
734 SlotIndex
Idx =
Use.first;
735 LiveQueryResult LRQ = SR.
Query(Idx);
747 WorkList.push_back(std::make_pair(Idx, VNI));
753 extendSegmentsToUses(NewLR, WorkList,
Reg, SR.
LaneMask);
759 for (VNInfo *VNI : SR.
valnos) {
763 assert(Segment !=
nullptr &&
"Missing segment for VNI");
769 <<
" may separate interval\n");
781 assert(LICalc &&
"LICalc not initialized.");
784 LICalc->extend(LR, Idx, 0, Undefs);
798 SlotIndex MBBEnd = Indexes->getMBBEndIdx(KillMBB);
809 if (EndPoints) EndPoints->
push_back(MBBEnd);
824 std::tie(MBBStart, MBBEnd) = Indexes->getMBBRange(
MBB);
842 if (EndPoints) EndPoints->
push_back(MBBEnd);
856 for (
unsigned i = 0, e = MRI->getNumVirtRegs(); i != e; ++i) {
858 if (MRI->reg_nodbg_empty(Reg))
874 auto [Unit, Bitmask] = *UI;
876 if (TRI->isArtificialRegUnit(Unit))
877 ArtificialLanes |= Bitmask;
888 if (RI->end.isBlock())
902 for (
auto &RUP : RU) {
905 if (
I == RURange.
end())
908 if (
I == RURange.
end() ||
I->start >= RI->end)
914 if (MRI->subRegLivenessEnabled()) {
933 DefinedLanesMask = ArtificialLanes;
936 if (Segment.
start >= RI->end)
938 if (Segment.
end == RI->end) {
946 bool IsFullWrite =
false;
948 if (!MO.isReg() || MO.getReg() != Reg)
952 unsigned SubReg = MO.getSubReg();
953 LaneBitmask UseMask = SubReg ? TRI->getSubRegIndexLaneMask(SubReg)
954 : MRI->getMaxLaneMaskForVReg(Reg);
955 if ((UseMask & ~DefinedLanesMask).any())
957 }
else if (MO.getSubReg() == 0) {
971 if (
N != LI.
end() &&
N->start == RI->end)
976 MI->addRegisterKilled(Reg,
nullptr);
979 MI->clearRegisterKills(Reg,
nullptr);
1007 return MBB1 == MBB2 ? MBB1 :
nullptr;
1013 if (
PHI->isUnused() || !
PHI->isPHIDef())
1037 const auto *MF =
MBB->getParent();
1052 float Weight = isDef + isUse;
1080 if (
MI->getOpcode() != TargetOpcode::STATEPOINT)
1122 auto unionBitMask = [&](
unsigned Idx) {
1126 UsableRegs.
resize(TRI->getNumRegs(),
true);
1133 assert(*SlotI >= LiveI->start);
1135 while (*SlotI < LiveI->end) {
1137 unionBitMask(SlotI - Slots.
begin());
1138 if (++SlotI == SlotE)
1142 if (*SlotI == LiveI->end)
1145 unionBitMask(SlotI++ - Slots.
begin());
1148 if (++LiveI == LiveE || SlotI == SlotE || *SlotI > LI.
endIndex())
1150 while (LiveI->end < *SlotI)
1153 while (*SlotI < LiveI->start)
1154 if (++SlotI == SlotE)
1178 : LIS(LIS), MRI(MRI), TRI(TRI), OldIdx(OldIdx), NewIdx(NewIdx),
1179 UpdateFlags(UpdateFlags) {}
1186 if (UpdateFlags && !MRI.isReservedRegUnit(Unit))
1187 return &LIS.getRegUnit(Unit);
1188 return LIS.getCachedRegUnit(Unit);
1194 LLVM_DEBUG(
dbgs() <<
"handleMove " << OldIdx <<
" -> " << NewIdx <<
": "
1196 bool hasRegMask =
false;
1207 MO.setIsKill(
false);
1213 if (Reg.isVirtual()) {
1216 unsigned SubReg = MO.getSubReg();
1217 LaneBitmask LaneMask = SubReg ? TRI.getSubRegIndexLaneMask(SubReg)
1218 : MRI.getMaxLaneMaskForVReg(Reg);
1220 if ((S.LaneMask & LaneMask).none())
1233 unsigned SubReg = MO.getSubReg();
1234 LaneBitmask LaneMask = SubReg ? TRI.getSubRegIndexLaneMask(SubReg)
1235 : MRI.getMaxLaneMaskForVReg(Reg);
1237 if ((S.LaneMask & LaneMask).none() || LI.
covers(S))
1240 LIS.constructMainRangeFromSubranges(LI);
1250 for (MCRegUnit Unit : TRI.regunits(Reg.asMCReg()))
1255 updateRegMaskSlots();
1263 if (!Updated.
insert(&LR).second)
1274 dbgs() <<
":\t" << LR <<
'\n';
1279 handleMoveUp(LR, VRegOrUnit, LaneMask);
1304 if (MachineInstr *KillMI = LIS.getInstructionFromIndex(OldIdxIn->end))
1306 if (MOP.isReg() && MOP.isUse())
1307 MOP.setIsKill(
false);
1318 if (NewIdxIn ==
E ||
1321 Prev->end = NewIdx.getRegSlot();
1324 OldIdxIn->end =
Next->start;
1331 OldIdxIn->end = NewIdx.getRegSlot(OldIdxIn->end.isEarlyClobber());
1341 OldIdxOut = OldIdxIn;
1348 VNInfo *OldIdxVNI = OldIdxOut->valno;
1349 assert(OldIdxVNI->
def == OldIdxOut->start &&
"Inconsistent def");
1353 SlotIndex NewIdxDef = NewIdx.getRegSlot(OldIdxOut->start.isEarlyClobber());
1355 OldIdxVNI->
def = NewIdxDef;
1356 OldIdxOut->start = OldIdxVNI->
def;
1365 = LR.
advanceTo(OldIdxOut, NewIdx.getRegSlot());
1366 bool OldIdxDefIsDead = OldIdxOut->end.isDead();
1367 if (!OldIdxDefIsDead &&
1371 if (OldIdxOut != LR.
begin() &&
1373 OldIdxOut->start)) {
1378 IPrev->end = OldIdxOut->end;
1382 assert(INext !=
E &&
"Must have following segment");
1388 INext->start = OldIdxOut->end;
1389 INext->valno->def = INext->start;
1392 if (AfterNewIdx ==
E) {
1397 std::copy(std::next(OldIdxOut),
E, OldIdxOut);
1400 *NewSegment = LiveRange::Segment(NewIdxDef, NewIdxDef.
getDeadSlot(),
1402 DefVNI->
def = NewIdxDef;
1405 Prev->end = NewIdxDef;
1411 std::copy(std::next(OldIdxOut), std::next(AfterNewIdx), OldIdxOut);
1418 *NewSegment = LiveRange::Segment(NewIdxDef, Prev->end, Prev->valno);
1419 Prev->valno->def = NewIdxDef;
1421 *Prev = LiveRange::Segment(Prev->start, NewIdxDef, DefVNI);
1422 DefVNI->
def = Prev->start;
1426 *Prev = LiveRange::Segment(NewIdxDef, AfterNewIdx->start, DefVNI);
1427 DefVNI->
def = NewIdxDef;
1428 assert(DefVNI != AfterNewIdx->valno);
1434 if (AfterNewIdx !=
E &&
1438 assert(AfterNewIdx->valno != OldIdxVNI &&
"Multiple defs of value?");
1446 assert(AfterNewIdx != OldIdxOut &&
"Inconsistent iterators");
1447 std::copy(std::next(OldIdxOut), AfterNewIdx, OldIdxOut);
1450 VNInfo *NewSegmentVNI = OldIdxVNI;
1451 NewSegmentVNI->
def = NewIdxDef;
1452 *NewSegment = LiveRange::Segment(NewIdxDef, NewIdxDef.
getDeadSlot(),
1459 void handleMoveUp(
LiveRange &LR, VirtRegOrUnit VRegOrUnit,
1460 LaneBitmask LaneMask) {
1481 SlotIndex DefBeforeOldIdx
1482 = std::max(OldIdxIn->start.getDeadSlot(),
1483 NewIdx.getRegSlot(OldIdxIn->end.isEarlyClobber()));
1484 OldIdxIn->end = findLastUseBefore(DefBeforeOldIdx, VRegOrUnit, LaneMask);
1487 OldIdxOut = std::next(OldIdxIn);
1491 OldIdxOut = OldIdxIn;
1492 OldIdxIn = OldIdxOut != LR.
begin() ? std::prev(OldIdxOut) :
E;
1499 VNInfo *OldIdxVNI = OldIdxOut->valno;
1500 assert(OldIdxVNI->
def == OldIdxOut->start &&
"Inconsistent def");
1501 bool OldIdxDefIsDead = OldIdxOut->end.isDead();
1504 SlotIndex NewIdxDef = NewIdx.
getRegSlot(OldIdxOut->start.isEarlyClobber());
1507 assert(NewIdxOut->valno != OldIdxVNI &&
1508 "Same value defined more than once?");
1510 if (!OldIdxDefIsDead) {
1513 OldIdxVNI->
def = NewIdxDef;
1514 OldIdxOut->start = NewIdxDef;
1523 if (!OldIdxDefIsDead) {
1525 if (OldIdxIn !=
E &&
1529 assert(NewIdxIn == LR.
find(NewIdx.getBaseIndex()));
1530 const SlotIndex SplitPos = NewIdxDef;
1531 OldIdxVNI = OldIdxIn->valno;
1533 SlotIndex NewDefEndPoint = std::next(NewIdxIn)->end;
1535 if (OldIdxIn != LR.
begin() &&
1543 NewDefEndPoint = std::min(OldIdxIn->start,
1544 std::next(NewIdxOut)->start);
1548 OldIdxOut->valno->def = OldIdxIn->start;
1549 *OldIdxOut = LiveRange::Segment(OldIdxIn->start, OldIdxOut->end,
1555 std::copy_backward(NewIdxIn, OldIdxIn, OldIdxOut);
1562 *NewSegment = LiveRange::Segment(
Next->start, SplitPos,
1565 *
Next = LiveRange::Segment(SplitPos, NewDefEndPoint, OldIdxVNI);
1566 Next->valno->def = SplitPos;
1570 *NewSegment = LiveRange::Segment(SplitPos,
Next->start, OldIdxVNI);
1571 NewSegment->valno->def = SplitPos;
1575 OldIdxOut->start = NewIdxDef;
1576 OldIdxVNI->
def = NewIdxDef;
1578 OldIdxIn->end = NewIdxDef;
1580 }
else if (OldIdxIn !=
E
1591 std::copy_backward(NewIdxOut, OldIdxOut, std::next(OldIdxOut));
1595 *NewIdxOut = LiveRange::Segment(
1596 NewIdxOut->start, NewIdxDef.
getRegSlot(), NewIdxOut->valno);
1597 *(NewIdxOut + 1) = LiveRange::Segment(
1598 NewIdxDef.
getRegSlot(), (NewIdxOut + 1)->end, OldIdxVNI);
1599 OldIdxVNI->
def = NewIdxDef;
1605 const SlotIndex RetagEnd = OldIdxOut->end;
1607 Idx != LR.
end() &&
Idx->start < RetagEnd;) {
1608 Idx->valno = OldIdxVNI;
1614 if (MachineInstr *KillMI = LIS.getInstructionFromIndex(NewIdx))
1615 for (MIBundleOperands MO(*KillMI); MO.isValid(); ++MO)
1616 if (MO->isReg() && !MO->isUse())
1617 MO->setIsDead(
false);
1624 std::copy_backward(NewIdxOut, OldIdxOut, std::next(OldIdxOut));
1627 VNInfo *NewSegmentVNI = OldIdxVNI;
1628 *NewSegment = LiveRange::Segment(NewIdxDef, NewIdxDef.
getDeadSlot(),
1630 NewSegmentVNI->
def = NewIdxDef;
1635 void updateRegMaskSlots() {
1638 assert(RI != LIS.RegMaskSlots.end() && *RI == OldIdx.getRegSlot() &&
1639 "No RegMask at OldIdx.");
1640 *RI = NewIdx.getRegSlot();
1641 assert((RI == LIS.RegMaskSlots.begin() ||
1643 "Cannot move regmask instruction above another call");
1644 assert((std::next(RI) == LIS.RegMaskSlots.end() ||
1646 "Cannot move regmask instruction below another call");
1650 SlotIndex findLastUseBefore(SlotIndex Before, VirtRegOrUnit VRegOrUnit,
1651 LaneBitmask LaneMask) {
1653 SlotIndex LastUse = Before;
1654 for (MachineOperand &MO :
1658 unsigned SubReg = MO.getSubReg();
1659 if (SubReg != 0 && LaneMask.
any()
1660 && (TRI.getSubRegIndexLaneMask(SubReg) & LaneMask).none())
1663 const MachineInstr &
MI = *MO.getParent();
1664 SlotIndex InstSlot = LIS.getSlotIndexes()->getInstructionIndex(
MI);
1665 if (InstSlot > LastUse && InstSlot < OldIdx)
1673 assert(Before < OldIdx &&
"Expected upwards move");
1674 SlotIndexes *Indexes = LIS.getSlotIndexes();
1682 if (
MI->getParent() ==
MBB)
1686 while (MII != Begin) {
1687 if ((--MII)->isDebugOrPseudoInstr())
1696 for (MIBundleOperands MO(*MII); MO.isValid(); ++MO)
1697 if (MO->isReg() && !MO->isUndef() && MO->getReg().isPhysical() &&
1698 TRI.hasRegUnit(MO->getReg(), VRegOrUnit.
asMCRegUnit()))
1699 return Idx.getRegSlot();
1709 assert((!
MI.isBundled() ||
MI.getOpcode() == TargetOpcode::BUNDLE) &&
1710 "Cannot move instruction in bundle");
1711 SlotIndex OldIndex = Indexes->getInstructionIndex(
MI);
1712 Indexes->removeMachineInstrFromMaps(
MI);
1713 SlotIndex NewIndex = Indexes->insertMachineInstrInMaps(
MI);
1716 "Cannot handle moves across basic block boundaries.");
1718 HMEditor HME(*
this, *MRI, *TRI, OldIndex, NewIndex, UpdateFlags);
1725 "Bundle start is not a bundle");
1727 const SlotIndex NewIndex = Indexes->insertMachineInstrInMaps(BundleStart);
1732 while (
I != BundleEnd) {
1733 if (!Indexes->hasIndex(*
I))
1735 SlotIndex OldIndex = Indexes->getInstructionIndex(*
I,
true);
1737 Indexes->removeMachineInstrFromMaps(*
I,
true);
1741 HMEditor HME(*
this, *MRI, *TRI, OldIndex, NewIndex, UpdateFlags);
1751 if (Reg.isVirtual() &&
hasInterval(Reg) && !MO.isUndef()) {
1767 if (LII != LR.
end() && LII->start < EndIdx) {
1768 lastUseIdx = LII->end;
1769 }
else if (LII == LR.
begin()) {
1778 MachineInstr &
MI = *
I;
1779 if (
MI.isDebugOrPseudoInstr())
1788 for (
const MachineOperand &MO :
MI.operands()) {
1789 if (!MO.isReg() || MO.getReg() !=
Reg)
1792 unsigned SubReg = MO.getSubReg();
1793 LaneBitmask
Mask = TRI->getSubRegIndexLaneMask(SubReg);
1794 if ((Mask & LaneMask).
none())
1798 if (!isStartValid) {
1799 if (LII->end.isDead()) {
1801 if (LII != LR.
begin())
1806 if (MO.getSubReg() && !MO.isUndef())
1809 lastUseIdx = SlotIndex();
1819 }
else if (LII->start != instrIdx.
getRegSlot()) {
1821 LiveRange::Segment S(instrIdx.
getRegSlot(), lastUseIdx, VNI);
1825 if (MO.getSubReg() && !MO.isUndef())
1828 lastUseIdx = SlotIndex();
1829 }
else if (MO.isUse()) {
1833 if (!isEndValid && !LII->end.isBlock())
1842 if (!isStartValid && LII->end.isDead())
1853 while (Begin !=
MBB->begin() && !Indexes->hasIndex(*std::prev(Begin)))
1855 while (
End !=
MBB->end() && !Indexes->hasIndex(*
End))
1864 Indexes->repairIndexesInRange(
MBB, Begin,
End);
1871 if (
MI.isDebugOrPseudoInstr())
1874 if (MO.isReg() && MO.getReg().isVirtual()) {
1877 MRI->shouldTrackSubRegLiveness(Reg)) {
1884 }
else if (MO.isDef()) {
1887 unsigned SubReg = MO.getSubReg();
1888 LaneBitmask Mask = TRI->getSubRegIndexLaneMask(SubReg);
1891 return SR.LaneMask == Mask;
1906 for (
Register Reg : RegsToRepair) {
1907 if (!Reg.isVirtual())
1916 repairOldRegInRange(Begin,
End, EndIdx, S, Reg, S.LaneMask);
1919 repairOldRegInRange(Begin,
End, EndIdx, LI, Reg);
1924 for (MCRegUnit Unit : TRI->regunits(Reg)) {
1935 if (VNI !=
nullptr) {
1942 if (
VNInfo *SVNI = S.getVNInfoAt(Pos))
1944 S.removeValNo(SVNI);
1952 unsigned NumComp = ConEQ.
Classify(LI);
1955 LLVM_DEBUG(
dbgs() <<
" Split " << NumComp <<
" components: " << LI <<
'\n');
1957 for (
unsigned I = 1;
I < NumComp; ++
I) {
1958 Register NewVReg = MRI->cloneVirtualRegister(Reg);
1966 assert(LICalc &&
"LICalc not initialized.");
1968 LICalc->constructMainRangeFromSubranges(LI);
MachineInstrBuilder & UseMI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
This file builds on the ADT/GraphTraits.h file to build generic depth first graph iterator.
A common definition of LaneBitmask for use in TableGen and CodeGen.
static cl::opt< bool > EnablePrecomputePhysRegs("precompute-phys-liveness", cl::Hidden, cl::desc("Eagerly compute live intervals for all physreg units."))
static bool hasLiveThroughUse(const MachineInstr *MI, Register Reg)
Check whether use of reg in MI is live-through.
static void createSegmentsForValues(LiveRange &LR, iterator_range< LiveInterval::vni_iterator > VNIs)
Register const TargetRegisterInfo * TRI
std::pair< uint64_t, uint64_t > Interval
Promote Memory to Register
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
MachineRegisterInfo & MRI
Remove Loads Into Fake Uses
SI Optimize VGPR LiveRange
This file defines the SmallPtrSet class.
This file defines the SmallVector class.
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
Toolkit used by handleMove to trim or extend live intervals.
HMEditor(LiveIntervals &LIS, const MachineRegisterInfo &MRI, const TargetRegisterInfo &TRI, SlotIndex OldIdx, SlotIndex NewIdx, bool UpdateFlags)
LiveRange * getRegUnitLI(MCRegUnit Unit)
void updateAllRanges(MachineInstr *MI)
Update all live ranges touched by MI, assuming a move from OldIdx to NewIdx.
This templated class represents "all analyses that operate over <aparticular IR unit>" (e....
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Represent the analysis usage information of a pass.
LLVM_ABI AnalysisUsage & addRequiredTransitiveID(char &ID)
AnalysisUsage & addPreservedID(const void *ID)
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
LLVM_ABI void setPreservesCFG()
This function should be called by the pass, iff they do not:
AnalysisUsage & addRequiredTransitive()
Represent a constant reference to an array (0 or more elements consecutively in memory),...
void resize(unsigned N, bool t=false)
Grow or shrink the bitvector.
void clear()
Removes all bits from the bitvector.
void clearBitsNotInMask(const uint32_t *Mask, unsigned MaskWords=~0u)
Clear a bit in this vector for every '0' bit in Mask.
ConnectedVNInfoEqClasses - Helper class that can divide VNInfos in a LiveInterval into equivalence cl...
LLVM_ABI void Distribute(LiveInterval &LI, LiveInterval *LIV[], MachineRegisterInfo &MRI)
Distribute values in LI into a separate LiveIntervals for each connected component.
LLVM_ABI unsigned Classify(const LiveRange &LR)
Classify the values in LR into connected components.
A live range for subregisters.
LiveInterval - This class represents the liveness of a register, or stack slot.
LLVM_ABI void removeEmptySubRanges()
Removes all subranges without any segments (subranges without segments are not considered valid and s...
bool hasSubRanges() const
Returns true if subregister liveness information is available.
iterator_range< subrange_iterator > subranges()
LLVM_ABI void computeSubRangeUndefs(SmallVectorImpl< SlotIndex > &Undefs, LaneBitmask LaneMask, const MachineRegisterInfo &MRI, const SlotIndexes &Indexes) const
For a given lane mask LaneMask, compute indexes at which the lane is marked undefined by subregister ...
LLVM_ABI Result run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
LLVM_ABI PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
bool runOnMachineFunction(MachineFunction &) override
Pass entry point; Calculates LiveIntervals.
LiveIntervalsWrapperPass()
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
LLVM_ABI ~LiveIntervals()
LLVM_ABI void repairIntervalsInRange(MachineBasicBlock *MBB, MachineBasicBlock::iterator Begin, MachineBasicBlock::iterator End, ArrayRef< Register > OrigRegs)
Update live intervals for instructions in a range of iterators.
bool hasInterval(Register Reg) const
SlotIndex getMBBStartIdx(const MachineBasicBlock *mbb) const
Return the first index in the given basic block.
MachineInstr * getInstructionFromIndex(SlotIndex index) const
Returns the instruction associated with the given index.
LLVM_ABI bool hasPHIKill(const LiveInterval &LI, const VNInfo *VNI) const
Returns true if VNI is killed by any PHI-def values in LI.
LLVM_ABI bool checkRegMaskInterference(const LiveInterval &LI, BitVector &UsableRegs)
Test if LI is live across any register mask instructions, and compute a bit mask of physical register...
LLVM_ABI void handleMove(MachineInstr &MI, bool UpdateFlags=false)
Call this method to notify LiveIntervals that instruction MI has been moved within a basic block.
SlotIndexes * getSlotIndexes() const
LLVM_ABI unsigned removeUnreferencedIntervals()
Remove intervals for virtual registers no instruction refers to any more.
ArrayRef< const uint32_t * > getRegMaskBits() const
Returns an array of register mask pointers corresponding to getRegMaskSlots().
LiveInterval & getOrCreateEmptyInterval(Register Reg)
Return an existing interval for Reg.
LLVM_ABI void addKillFlags(const VirtRegMap *)
Add kill flags to any instruction that kills a virtual register.
SlotIndex getInstructionIndex(const MachineInstr &Instr) const
Returns the base index of the given instruction.
LLVM_ABI bool invalidate(MachineFunction &MF, const PreservedAnalyses &PA, MachineFunctionAnalysisManager::Invalidator &Inv)
VNInfo::Allocator & getVNInfoAllocator()
ArrayRef< const uint32_t * > getRegMaskBitsInBlock(unsigned MBBNum) const
Returns an array of mask pointers corresponding to getRegMaskSlotsInBlock(MBBNum).
SlotIndex getMBBEndIdx(const MachineBasicBlock *mbb) const
Return the last index in the given basic block.
static LLVM_ABI float getSpillWeight(bool isDef, bool isUse, const MachineBlockFrequencyInfo *MBFI, const MachineInstr &MI, ProfileSummaryInfo *PSI=nullptr)
Calculate the spill weight to assign to a single instruction.
ArrayRef< SlotIndex > getRegMaskSlots() const
Returns a sorted array of slot indices of all instructions with register mask operands.
ArrayRef< SlotIndex > getRegMaskSlotsInBlock(unsigned MBBNum) const
Returns a sorted array of slot indices of all instructions with register mask operands in the basic b...
LiveInterval & getInterval(Register Reg)
friend class LiveIntervalsAnalysis
LLVM_ABI void pruneValue(LiveRange &LR, SlotIndex Kill, SmallVectorImpl< SlotIndex > *EndPoints)
If LR has a live value at Kill, prune its live range by removing any liveness reachable from Kill.
void removeInterval(Register Reg)
Interval removal.
LLVM_ABI void handleMoveIntoNewBundle(MachineInstr &BundleStart, bool UpdateFlags=false)
Update intervals of operands of all instructions in the newly created bundle specified by BundleStart...
LiveRange & getRegUnit(MCRegUnit Unit)
Return the live range for register unit Unit.
LLVM_ABI bool shrinkToUses(LiveInterval *li, SmallVectorImpl< MachineInstr * > *dead=nullptr, LaneBitmask SubRangeMask=LaneBitmask::getAll())
After removing some uses of a register, shrink its live range to just the remaining uses.
LLVM_ABI MachineBasicBlock * intervalIsInOneMBB(const LiveInterval &LI) const
If LI is confined to a single basic block, return a pointer to that block.
LiveRange * getCachedRegUnit(MCRegUnit Unit)
Return the live range for register unit Unit if it has already been computed, or nullptr if it hasn't...
LLVM_ABI void removeVRegDefAt(LiveInterval &LI, SlotIndex Pos)
Remove value number and related live segments of LI and its subranges that start at position Pos.
LLVM_ABI LiveInterval::Segment addSegmentToEndOfBlock(Register Reg, MachineInstr &startInst)
Given a register and an instruction, adds a live segment from that instruction to the end of its MBB.
LLVM_ABI void constructMainRangeFromSubranges(LiveInterval &LI)
For live interval LI with correct SubRanges construct matching information for the main live range.
LiveInterval & createEmptyInterval(Register Reg)
Interval creation.
LLVM_ABI void extendToIndices(LiveRange &LR, ArrayRef< SlotIndex > Indices, ArrayRef< SlotIndex > Undefs)
Extend the live range LR to reach all points in Indices.
LLVM_ABI void dump() const
LLVM_ABI void print(raw_ostream &O) const
Implement the dump method.
LLVM_ABI void removePhysRegDefAt(MCRegister Reg, SlotIndex Pos)
Remove value numbers and related live segments starting at position Pos that are part of any liverang...
LLVM_ABI void splitSeparateComponents(LiveInterval &LI, SmallVectorImpl< LiveInterval * > &SplitLIs)
Split separate components in LiveInterval LI into separate intervals.
MachineBasicBlock * getMBBFromIndex(SlotIndex index) const
LiveInterval & createAndComputeVirtRegInterval(Register Reg)
Result of a LiveRange query.
VNInfo * valueOutOrDead() const
Returns the value alive at the end of the instruction, if any.
bool isDeadDef() const
Return true if this instruction has a dead def.
VNInfo * valueIn() const
Return the value that is live-in to the instruction.
VNInfo * valueDefined() const
Return the value defined by this instruction, if any.
SlotIndex endPoint() const
Return the end point of the last live range segment to interact with the instruction,...
static LLVM_ABI bool isJointlyDominated(const MachineBasicBlock *MBB, ArrayRef< SlotIndex > Defs, const SlotIndexes &Indexes)
A diagnostic function to check if the end of the block MBB is jointly dominated by the blocks corresp...
This class represents the liveness of a register, stack slot, etc.
LLVM_ABI iterator addSegment(Segment S)
Add the specified Segment to this range, merging segments as appropriate.
Segments::iterator iterator
const Segment * getSegmentContaining(SlotIndex Idx) const
Return the segment that contains the specified index, or null if there is none.
iterator_range< vni_iterator > vnis()
Segments::const_iterator const_iterator
LLVM_ABI VNInfo * createDeadDef(SlotIndex Def, VNInfo::Allocator &VNIAlloc)
createDeadDef - Make sure the range has a value defined at Def.
LLVM_ABI iterator mergeAdjacentSegments(iterator I)
Merge the segment pointed to by I with its immediate neighbors when they use the same value number an...
LLVM_ABI bool covers(const LiveRange &Other) const
Returns true if all segments of the Other live range are completely covered by this live range.
iterator advanceTo(iterator I, SlotIndex Pos)
advanceTo - Advance the specified iterator to point to the Segment containing the specified position,...
LLVM_ABI void removeValNo(VNInfo *ValNo)
removeValNo - Remove all the segments defined by the specified value#.
LiveQueryResult Query(SlotIndex Idx) const
Query Liveness at Idx.
VNInfo * getVNInfoBefore(SlotIndex Idx) const
getVNInfoBefore - Return the VNInfo that is live up to but not necessarily including Idx,...
bool verify() const
Walk the range and assert if any invariants fail to hold.
SlotIndex beginIndex() const
beginIndex - Return the lowest numbered slot covered.
SlotIndex endIndex() const
endNumber - return the maximum point of the range of the whole, exclusive.
bool hasAtLeastOneValue() const
VNInfo * getNextValue(SlotIndex Def, VNInfo::Allocator &VNInfoAllocator)
getNextValue - Create a new value number and return it.
iterator FindSegmentContaining(SlotIndex Idx)
Return an iterator to the segment that contains the specified index, or end() if there is none.
LLVM_ABI void removeSegment(SlotIndex Start, SlotIndex End, bool RemoveDeadValNo=false)
Remove the specified interval from this live range.
VNInfo * getVNInfoAt(SlotIndex Idx) const
getVNInfoAt - Return the VNInfo that is live at Idx, or NULL.
LLVM_ABI iterator find(SlotIndex Pos)
find - Return an iterator pointing to the first segment that ends after Pos, or end().
MCRegUnitMaskIterator enumerates a list of register units and their associated lane masks for Reg.
bool isValid() const
Returns true if this iterator is not yet at the end.
Wrapper class representing physical registers. Should be passed by value.
unsigned pred_size() const
bool isEHPad() const
Returns true if the block is a landing pad.
iterator_range< livein_iterator > liveins() const
int getNumber() const
MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a MachineFuncti...
bool livein_empty() const
LLVM_ABI const uint32_t * getBeginClobberMask(const TargetRegisterInfo *TRI) const
Get the clobber mask for the start of this basic block.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
iterator_range< succ_iterator > successors()
iterator_range< pred_iterator > predecessors()
MachineInstrBundleIterator< MachineInstr > iterator
LLVM_ABI const uint32_t * getEndClobberMask(const TargetRegisterInfo *TRI) const
Get the clobber mask for the end of the basic block.
MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate machine basic b...
double getBlockFreqRelativeToEntryBlock(const MachineBasicBlock *MBB) const
Compute the frequency of the block, relative to the entry block.
Analysis pass which computes a MachineDominatorTree.
Analysis pass which computes a MachineDominatorTree.
MachineFunctionPass(char &ID)
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
void print(raw_ostream &OS, const SlotIndexes *=nullptr) const
print - Print out the MachineFunction in a format suitable for debugging to the specified stream.
Representation of each machine instruction.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
const MachineBasicBlock * getParent() const
MachineOperand class - Representation of each machine instruction operand.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
Register getReg() const
getReg - Returns the register number.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
AnalysisType & getAnalysis() const
getAnalysis<AnalysisType>() - This function is used by subclasses to get to the analysis information ...
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
PreservedAnalysisChecker getChecker() const
Build a checker for this PreservedAnalyses and the specified analysis type.
Analysis providing profile information.
Wrapper class representing virtual and physical registers.
static Register index2VirtReg(unsigned Index)
Convert a 0-based index to a virtual register number.
constexpr bool isVirtual() const
Return true if the specified register number is in the virtual register namespace.
constexpr bool isPhysical() const
Return true if the specified register number is in the physical register namespace.
SlotIndex - An opaque wrapper around machine indexes.
static bool isSameInstr(SlotIndex A, SlotIndex B)
isSameInstr - Return true if A and B refer to the same instruction.
bool isBlock() const
isBlock - Returns true if this is a block boundary slot.
SlotIndex getDeadSlot() const
Returns the dead def kill slot for the current instruction.
static bool isEarlierInstr(SlotIndex A, SlotIndex B)
isEarlierInstr - Return true if A refers to an instruction earlier than B.
bool isValid() const
Returns true if this is a valid index.
static bool isEarlierEqualInstr(SlotIndex A, SlotIndex B)
Return true if A refers to the same instruction as B or an earlier one.
SlotIndex getBaseIndex() const
Returns the base index for associated with this index.
SlotIndex getPrevSlot() const
Returns the previous slot in the index list.
SlotIndex getRegSlot(bool EC=false) const
Returns the register use/def slot in the current instruction for a normal or early-clobber def.
MachineBasicBlock * getMBBFromIndex(SlotIndex index) const
Returns the basic block which the given index falls in.
SlotIndex getNextNonNullIndex(SlotIndex Index)
Returns the next non-null index, if one exists.
SlotIndex getInstructionIndex(const MachineInstr &MI, bool IgnoreBundle=false) const
Returns the base index for the given instruction.
MachineInstr * getInstructionFromIndex(SlotIndex index) const
Returns the instruction for the given index, or null if the given index has no instruction associated...
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void swap(SmallVectorImpl &RHS)
typename SuperClass::iterator iterator
void push_back(const T &Elt)
pointer data()
Return a pointer to the vector's buffer, even if empty().
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
MI-level Statepoint operands.
unsigned getNumDeoptArgsIdx() const
Get index of Number Deopt Arguments operand.
uint64_t getFlags() const
Return the statepoint flags.
LLVM_ABI unsigned getNumGCPtrIdx()
Get index of number of GC pointers.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
VNInfo - Value Number Information.
void markUnused()
Mark this value as unused.
bool isUnused() const
Returns true if this value is unused.
unsigned id
The ID number of this value.
SlotIndex def
The index of the defining instruction.
bool isPHIDef() const
Returns true if this value is defined by a PHI instruction (or was, PHI instructions may have been el...
MCRegister getPhys(Register virtReg) const
returns the physical register mapped to the specified virtual register
Wrapper class representing a virtual register or register unit.
constexpr bool isVirtualReg() const
constexpr MCRegUnit asMCRegUnit() const
constexpr Register asVirtualReg() const
self_iterator getIterator()
A range adaptor for a pair of iterators.
This class implements an extremely fast bulk output stream that can only output to a stream.
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
constexpr std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
NodeAddr< DefNode * > Def
NodeAddr< UseNode * > Use
This is an optimization pass for GlobalISel generic memory operations.
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
Printable print(const GCNRegPressure &RP, const GCNSubtarget *ST=nullptr, unsigned DynamicVGPRBlockSize=0)
@ Kill
The last use of a register.
LLVM_ABI char & MachineDominatorsID
MachineDominators - This pass is a machine dominators analysis pass.
auto partition_point(R &&Range, Predicate P)
Binary search for the first iterator in a range where a predicate is false.
LLVM_ABI bool shouldOptimizeForSize(const MachineFunction *MF, ProfileSummaryInfo *PSI, const MachineBlockFrequencyInfo *BFI, PGSOQueryType QueryType=PGSOQueryType::Other)
Returns true if machine function MF is suggested to be size-optimized based on the profile.
Printable PrintLaneMask(LaneBitmask LaneMask)
Create Printable object to print LaneBitmasks on a raw_ostream.
LLVM_ABI Printable printRegUnit(MCRegUnit Unit, const TargetRegisterInfo *TRI)
Create Printable object to print register units on a raw_ostream.
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
void erase(Container &C, ValueType V)
Wrapper function to remove a value from a container:
LLVM_ABI char & MachineLoopInfoID
MachineLoopInfo - This pass is a loop analysis pass.
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
void sort(IteratorTy Start, IteratorTy End)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
df_ext_iterator< T, SetTy > df_ext_begin(const T &G, SetTy &S)
bool none_of(R &&Range, UnaryPredicate P)
Provide wrappers to std::none_of which take ranges instead of having to pass begin/end explicitly.
MachineBasicBlock::instr_iterator getBundleEnd(MachineBasicBlock::instr_iterator I)
Returns an iterator pointing beyond the bundle containing I.
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
LLVM_ABI const float huge_valf
Use this rather than HUGE_VALF; the latter causes warnings on MSVC.
auto lower_bound(R &&Range, T &&Value)
Provide wrappers to std::lower_bound which take ranges instead of having to pass begin/end explicitly...
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
ArrayRef(const T &OneElt) -> ArrayRef< T >
@ DeoptLiveIn
Mark the deopt arguments associated with the statepoint as only being "live-in".
iterator_range< MIBundleOperands > mi_bundle_ops(MachineInstr &MI)
df_ext_iterator< T, SetTy > df_ext_end(const T &G, SetTy &S)
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Next
@ End
Run the machine verifier once, at the end of the pipeline.
LLVM_ABI Printable printReg(Register Reg, const TargetRegisterInfo *TRI=nullptr, unsigned SubIdx=0, const MachineRegisterInfo *MRI=nullptr)
Prints virtual and physical registers with or without a TRI instance.
LLVM_ABI char & LiveIntervalsID
LiveIntervals - This analysis keeps track of the live ranges of virtual and physical registers.
LLVM_ABI Printable printMBBReference(const MachineBasicBlock &MBB)
Prints a machine basic block reference.
A special type used by analysis passes to provide an address that identifies that particular analysis...
static constexpr LaneBitmask getAll()
constexpr bool none() const
constexpr bool any() const
static constexpr LaneBitmask getNone()
This represents a simple continuous liveness interval for a value.