21#define DEBUG_TYPE "machine-scheduler"
25 if (
S1.size() != S2.
size())
28 for (
const auto &
P :
S1) {
30 if (
I == S2.
end() ||
I->second !=
P.second)
54 if (NewNumCoveredRegs == PrevNumCoveredRegs)
58 if (NewMask < PrevMask) {
60 std::swap(NewNumCoveredRegs, PrevNumCoveredRegs);
63 assert(PrevMask < NewMask && PrevNumCoveredRegs < NewNumCoveredRegs &&
64 "prev mask should always be lesser than new");
69 unsigned RegKind = getRegKind(RC, STI);
70 if (
TRI->getRegSizeInBits(*RC) != 32) {
72 if (PrevMask.
none()) {
74 Value[TupleIdx] += Sign *
TRI->getRegClassWeight(RC).RegWeight;
94 Sign *= NewNumCoveredRegs - PrevNumCoveredRegs;
100 unsigned MaxOccupancy)
const {
102 unsigned DynamicVGPRBlockSize =
105 const auto SGPROcc = std::min(MaxOccupancy,
107 const auto VGPROcc = std::min(
108 MaxOccupancy, ST.getOccupancyWithNumVGPRs(
getVGPRNum(ST.hasGFX90AInsts()),
109 DynamicVGPRBlockSize));
110 const auto OtherSGPROcc = std::min(MaxOccupancy,
111 ST.getOccupancyWithNumSGPRs(O.getSGPRNum()));
112 const auto OtherVGPROcc =
113 std::min(MaxOccupancy,
114 ST.getOccupancyWithNumVGPRs(O.getVGPRNum(ST.hasGFX90AInsts()),
115 DynamicVGPRBlockSize));
117 const auto Occ = std::min(SGPROcc, VGPROcc);
118 const auto OtherOcc = std::min(OtherSGPROcc, OtherVGPROcc);
122 return Occ > OtherOcc;
124 unsigned MaxVGPRs = ST.getMaxNumVGPRs(MF);
125 unsigned MaxSGPRs = ST.getMaxNumSGPRs(MF);
128 unsigned ExcessSGPR = std::max(
static_cast<int>(
getSGPRNum() - MaxSGPRs), 0);
129 unsigned OtherExcessSGPR =
130 std::max(
static_cast<int>(O.getSGPRNum() - MaxSGPRs), 0);
132 auto WaveSize = ST.getWavefrontSize();
134 unsigned VGPRForSGPRSpills = (ExcessSGPR + (WaveSize - 1)) / WaveSize;
135 unsigned OtherVGPRForSGPRSpills =
136 (OtherExcessSGPR + (WaveSize - 1)) / WaveSize;
138 unsigned MaxArchVGPRs = ST.getAddressableNumArchVGPRs();
142 unsigned ExcessVGPR =
143 std::max(
static_cast<int>(
getVGPRNum(ST.hasGFX90AInsts()) +
144 VGPRForSGPRSpills - MaxVGPRs),
146 unsigned OtherExcessVGPR =
147 std::max(
static_cast<int>(O.getVGPRNum(ST.hasGFX90AInsts()) +
148 OtherVGPRForSGPRSpills - MaxVGPRs),
152 unsigned ExcessArchVGPR = std::max(
153 static_cast<int>(
getVGPRNum(
false) + VGPRForSGPRSpills - MaxArchVGPRs),
155 unsigned OtherExcessArchVGPR =
156 std::max(
static_cast<int>(O.getVGPRNum(
false) + OtherVGPRForSGPRSpills -
160 unsigned ExcessAGPR = std::max(
161 static_cast<int>(ST.hasGFX90AInsts() ? (
getAGPRNum() - MaxArchVGPRs)
164 unsigned OtherExcessAGPR = std::max(
165 static_cast<int>(ST.hasGFX90AInsts() ? (O.getAGPRNum() - MaxArchVGPRs)
166 : (O.getAGPRNum() - MaxVGPRs)),
169 bool ExcessRP = ExcessSGPR || ExcessVGPR || ExcessArchVGPR || ExcessAGPR;
170 bool OtherExcessRP = OtherExcessSGPR || OtherExcessVGPR ||
171 OtherExcessArchVGPR || OtherExcessAGPR;
175 if (ExcessRP || OtherExcessRP) {
178 int VGPRDiff = ((OtherExcessVGPR + OtherExcessArchVGPR + OtherExcessAGPR) -
179 (ExcessVGPR + ExcessArchVGPR + ExcessAGPR));
181 int SGPRDiff = OtherExcessSGPR - ExcessSGPR;
186 unsigned PureExcessVGPR =
187 std::max(
static_cast<int>(
getVGPRNum(ST.hasGFX90AInsts()) - MaxVGPRs),
189 std::max(
static_cast<int>(
getVGPRNum(
false) - MaxArchVGPRs), 0);
190 unsigned OtherPureExcessVGPR =
192 static_cast<int>(O.getVGPRNum(ST.hasGFX90AInsts()) - MaxVGPRs),
194 std::max(
static_cast<int>(O.getVGPRNum(
false) - MaxArchVGPRs), 0);
199 if (PureExcessVGPR != OtherPureExcessVGPR)
207 bool SGPRImportant = SGPROcc < VGPROcc;
208 const bool OtherSGPRImportant = OtherSGPROcc < OtherVGPROcc;
211 if (SGPRImportant != OtherSGPRImportant) {
212 SGPRImportant =
false;
216 bool SGPRFirst = SGPRImportant;
217 for (
int I = 2;
I > 0; --
I, SGPRFirst = !SGPRFirst) {
220 auto OtherSW = O.getSGPRTuplesWeight();
225 auto OtherVW = O.getVGPRTuplesWeight();
232 return SGPRImportant ? (
getSGPRNum() < O.getSGPRNum()):
234 O.getVGPRNum(ST.hasGFX90AInsts()));
238 unsigned DynamicVGPRBlockSize) {
240 OS <<
"VGPRs: " << RP.getArchVGPRNum() <<
' '
241 <<
"AGPRs: " << RP.getAGPRNum();
244 << ST->getOccupancyWithNumVGPRs(RP.getVGPRNum(ST->hasGFX90AInsts()),
245 DynamicVGPRBlockSize)
247 OS <<
", SGPRs: " << RP.getSGPRNum();
249 OS <<
"(O" << ST->getOccupancyWithNumSGPRs(RP.getSGPRNum()) <<
')';
250 OS <<
", LVGPR WT: " << RP.getVGPRTuplesWeight()
251 <<
", LSGPR WT: " << RP.getSGPRTuplesWeight();
253 OS <<
" -> Occ: " << RP.getOccupancy(*ST, DynamicVGPRBlockSize);
267 MRI.getTargetRegisterInfo()->getSubRegIndexLaneMask(MO.
getSubReg());
275 auto &
TRI = *
MRI.getTargetRegisterInfo();
276 for (
const auto &MO :
MI.operands()) {
277 if (!MO.isReg() || !MO.getReg().isVirtual())
279 if (!MO.isUse() || !MO.readsReg())
284 return RM.RegUnit == Reg;
287 auto &
P =
I == VRegMaskOrUnits.
end()
291 P.LaneMask |= MO.getSubReg() ?
TRI.getSubRegIndexLaneMask(MO.getSubReg())
292 :
MRI.getMaxLaneMaskForVReg(Reg);
296 for (
auto &
P : VRegMaskOrUnits) {
298 if (!LI.hasSubRanges())
322 if (Property(SR, Pos))
323 Result |= SR.LaneMask;
325 }
else if (Property(LI, Pos)) {
326 Result = TrackLaneMasks ?
MRI.getMaxLaneMaskForVReg(RegUnit)
348 bool Upward =
false) {
354 bool InRange = Upward ? (InstSlot > PriorUseIdx && InstSlot <= NextUseIdx)
355 : (InstSlot >= PriorUseIdx && InstSlot < NextUseIdx);
359 unsigned SubRegIdx = MO.getSubReg();
361 LastUseMask &= ~UseMask;
362 if (LastUseMask.
none())
375 setTarget(ST.getMaxNumSGPRs(
F), ST.getMaxNumVGPRs(
F));
388 unsigned DynamicVGPRBlockSize =
390 setTarget(ST.getMaxNumSGPRs(Occupancy,
false),
391 ST.getMaxNumVGPRs(Occupancy, DynamicVGPRBlockSize));
396 MaxSGPRs = std::min(ST.getAddressableNumSGPRs(), NumSGPRs);
397 MaxVGPRs = std::min(ST.getAddressableNumArchVGPRs(), NumVGPRs);
399 unsigned DynamicVGPRBlockSize =
402 std::min(ST.getAddressableNumVGPRs(DynamicVGPRBlockSize), NumVGPRs);
415 return RP.getSGPRNum() > MaxSGPRs;
417 SRI->
isAGPRClass(RC) ? RP.getAGPRNum() : RP.getArchVGPRNum();
419 if (NumVGPRs > MaxVGPRs)
422 return UnifiedRF && RP.getVGPRNum(
true) > MaxUnifiedVGPRs;
426 if (RP.getSGPRNum() > MaxSGPRs || RP.getVGPRNum(
false) > MaxVGPRs)
428 if (UnifiedRF && RP.getVGPRNum(
true) > MaxUnifiedVGPRs)
449 if ((S.LaneMask & LaneMaskFilter).any() && S.liveAt(
SI)) {
450 LiveMask |= S.LaneMask;
451 assert(LiveMask == (LiveMask &
MRI.getMaxLaneMaskForVReg(LI.
reg())));
454 LiveMask =
MRI.getMaxLaneMaskForVReg(LI.
reg());
456 LiveMask &= LaneMaskFilter;
464 for (
unsigned I = 0, E =
MRI.getNumVirtRegs();
I != E; ++
I) {
470 LiveRegs[Reg] = LiveMask;
505 const LiveRange::Segment *S = LR.getSegmentContaining(Pos);
506 return S != nullptr && S->end == Pos.getRegSlot();
518 if (
MI.isDebugInstr())
523 bool HasECDefs =
false;
525 if (!MO.getReg().isVirtual())
532 if (MO.isEarlyClobber()) {
544 LiveMask &= ~DefMask;
553 DefPressure += ECDefPressure;
562 LiveMask |= U.LaneMask;
578 MRI = &
MI.getParent()->getParent()->getRegInfo();
580 MBBEnd =
MI.getParent()->end();
583 if (NextMI == MBBEnd)
590 bool UseInternalIterator) {
594 if (UseInternalIterator) {
596 return NextMI == MBBEnd;
598 assert(NextMI == MBBEnd || !NextMI->isDebugInstr());
601 SI = NextMI == MBBEnd
602 ?
LIS.getInstructionIndex(*LastTrackedMI).getDeadSlot()
603 :
LIS.getInstructionIndex(*NextMI).getBaseIndex();
605 SI =
LIS.getInstructionIndex(*MI).getBaseIndex();
613 for (
auto &MO : CurrMI->
operands()) {
614 if (!MO.isReg() || !MO.getReg().isVirtual())
616 if (MO.isUse() && !MO.readsReg())
618 if (!UseInternalIterator && MO.isDef())
620 if (!SeenRegs.
insert(MO.getReg()).second)
632 auto PrevMask = It->second;
633 It->second &= ~S.LaneMask;
637 if (It !=
LiveRegs.end() && It->second.none())
640 auto It =
LiveRegs.find(MO.getReg());
652 return UseInternalIterator && (NextMI == MBBEnd);
656 bool UseInternalIterator) {
657 if (UseInternalIterator) {
667 for (
const auto &MO : CurrMI->
all_defs()) {
669 if (!Reg.isVirtual())
672 auto PrevMask = LiveMask;
681 if (UseInternalIterator && NextMI == MBBEnd)
686 if (!UseInternalIterator) {
694 while (NextMI != End)
702 reset(*Begin, LiveRegsCopy);
710 for (
auto const &
P : TrackedLR) {
711 auto I = LISLR.
find(
P.first);
712 if (
I == LISLR.
end()) {
714 <<
" isn't found in LIS reported set\n";
715 }
else if (
I->second !=
P.second) {
717 <<
" masks doesn't match: LIS reported " <<
PrintLaneMask(
I->second)
721 for (
auto const &
P : LISLR) {
722 auto I = TrackedLR.find(
P.first);
723 if (
I == TrackedLR.end()) {
725 <<
" isn't found in tracked set\n";
734 assert(!
MI->isDebugOrPseudoInstr() &&
"Expect a nondebug instruction.");
737 SlotIdx =
LIS.getInstructionIndex(*MI).getRegSlot();
747 if (!Reg.isVirtual())
750 if (LastUseMask.
none())
761 if (IdxPos ==
MBB->end()) {
762 CurrIdx =
LIS.getMBBEndIdx(
MBB);
764 CurrIdx =
LIS.getInstructionIndex(*IdxPos).getRegSlot();
769 if (LastUseMask.
none())
775 TempPressure.
inc(Reg, LiveMask, NewMask, *
MRI);
781 if (!Reg.isVirtual())
786 TempPressure.
inc(Reg, LiveMask, NewMask, *
MRI);
793 const auto &
SI =
LIS.getInstructionIndex(*LastTrackedMI).getBaseIndex();
797 if (!
isEqual(LISLR, TrackedLR)) {
798 dbgs() <<
"\nGCNUpwardRPTracker error: Tracked and"
799 " LIS reported livesets mismatch:\n"
807 dbgs() <<
"GCNUpwardRPTracker error: Pressure sets different\nTracked: "
818 for (
unsigned I = 0, E =
MRI.getNumVirtRegs();
I != E; ++
I) {
820 auto It = LiveRegs.find(Reg);
821 if (It != LiveRegs.end() && It->second.any())
832 "amdgpu-print-rp-downward",
833 cl::desc(
"Use GCNDownwardRPTracker for GCNRegPressurePrinter pass"),
848 auto IsInOneSegment = [Begin, End](
const LiveRange &LR) ->
bool {
849 auto *Segment = LR.getSegmentContaining(Begin);
850 return Segment && Segment->contains(End);
856 for (auto &SR : LI.subranges()) {
857 if ((SR.LaneMask & Mask) == SR.LaneMask && IsInOneSegment(SR))
858 LiveThroughMask |= SR.LaneMask;
862 if ((RegMask & Mask) == RegMask && IsInOneSegment(LI))
863 LiveThroughMask = RegMask;
866 return LiveThroughMask;
879 OS <<
"---\nname: " << MF.
getName() <<
"\nbody: |\n";
883 OS <<
format(
PFX " %-5d", RP.getSGPRNum())
884 <<
format(
" %-5d", RP.getVGPRNum(
false));
890 if (LISLR != TrackedLR) {
899 for (
auto &
MBB : MF) {
901 RP.reserve(
MBB.size());
942 if (!
MI.isDebugInstr())
951 ReportLISMismatchIfAny(LiveIn,
getLiveRegs(MBBStartSlot, LIS,
MRI));
953 OS <<
PFX " SGPR VGPR\n";
955 for (
auto &
MI :
MBB) {
956 if (!
MI.isDebugInstr()) {
957 auto &[RPBeforeInstr, RPAtInstr] =
960 OS << printRP(RPBeforeInstr) <<
'\n' << printRP(RPAtInstr) <<
" ";
965 OS << printRP(RPAtMBBEnd) <<
'\n';
969 ReportLISMismatchIfAny(LiveOut,
getLiveRegs(MBBEndSlot, LIS,
MRI));
972 for (
auto [Reg, Mask] : LiveIn) {
974 if (MaskIntersection.
any()) {
976 MRI, LIS, Reg, MBBStartSlot, MBBEndSlot, MaskIntersection);
978 LiveThrough[Reg] = LTMask;
unsigned const MachineRegisterInfo * MRI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static void collectVirtualRegUses(SmallVectorImpl< VRegMaskOrUnit > &VRegMaskOrUnits, const MachineInstr &MI, const LiveIntervals &LIS, const MachineRegisterInfo &MRI)
static cl::opt< bool > UseDownwardTracker("amdgpu-print-rp-downward", cl::desc("Use GCNDownwardRPTracker for GCNRegPressurePrinter pass"), cl::init(false), cl::Hidden)
static LaneBitmask getDefRegMask(const MachineOperand &MO, const MachineRegisterInfo &MRI)
static LaneBitmask getRegLiveThroughMask(const MachineRegisterInfo &MRI, const LiveIntervals &LIS, Register Reg, SlotIndex Begin, SlotIndex End, LaneBitmask Mask=LaneBitmask::getAll())
This file defines the GCNRegPressure class, which tracks registry pressure by bookkeeping number of S...
Register const TargetRegisterInfo * TRI
static bool InRange(int64_t Value, unsigned short Shift, int LBound, int HBound)
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
static LaneBitmask findUseBetween(unsigned Reg, LaneBitmask LastUseMask, SlotIndex PriorUseIdx, SlotIndex NextUseIdx, const MachineRegisterInfo &MRI, const LiveIntervals *LIS)
Helper to find a vreg use between two indices [PriorUseIdx, NextUseIdx).
static LaneBitmask getLanesWithProperty(const LiveIntervals &LIS, const MachineRegisterInfo &MRI, bool TrackLaneMasks, Register RegUnit, SlotIndex Pos, LaneBitmask SafeDefault, bool(*Property)(const LiveRange &LR, SlotIndex Pos))
ValueT lookup(const_arg_type_t< KeyT > Val) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
iterator find(const_arg_type_t< KeyT > Val)
bool advanceBeforeNext(MachineInstr *MI=nullptr, bool UseInternalIterator=true)
Move to the state right before the next MI or after the end of MBB.
bool advance(MachineInstr *MI=nullptr, bool UseInternalIterator=true)
Move to the state at the next MI.
GCNRegPressure bumpDownwardPressure(const MachineInstr *MI, const SIRegisterInfo *TRI) const
Mostly copy/paste from CodeGen/RegisterPressure.cpp Calculate the impact MI will have on CurPressure ...
bool reset(const MachineInstr &MI, const LiveRegSet *LiveRegs=nullptr)
Reset tracker to the point before the MI filling LiveRegs upon this point using LIS.
void advanceToNext(MachineInstr *MI=nullptr, bool UseInternalIterator=true)
Move to the state at the MI, advanceBeforeNext has to be called first.
GCNRPTarget(const MachineFunction &MF, const GCNRegPressure &RP)
Sets up the target such that the register pressure starting at RP does not show register spilling on ...
bool isSaveBeneficial(Register Reg) const
Determines whether saving virtual register Reg will be beneficial towards achieving the RP target.
bool satisfied() const
Whether the current RP is at or below the defined pressure target.
void setTarget(unsigned NumSGPRs, unsigned NumVGPRs)
Changes the target (same semantics as constructor).
GCNRegPressure getPressure() const
const decltype(LiveRegs) & getLiveRegs() const
const MachineInstr * LastTrackedMI
GCNRegPressure CurPressure
DenseMap< unsigned, LaneBitmask > LiveRegSet
GCNRegPressure MaxPressure
void reset(const MachineInstr &MI, const LiveRegSet *LiveRegsCopy, bool After)
LaneBitmask getLastUsedLanes(Register RegUnit, SlotIndex Pos) const
Mostly copy/paste from CodeGen/RegisterPressure.cpp.
const MachineRegisterInfo * MRI
const LiveIntervals & LIS
void reset(const MachineRegisterInfo &MRI, SlotIndex SI)
reset tracker at the specified slot index SI.
void recede(const MachineInstr &MI)
Move to the state of RP just before the MI .
const GCNRegPressure & getMaxPressure() const
bool isValid() const
returns whether the tracker's state after receding MI corresponds to reported by LIS.
A live range for subregisters.
LiveInterval - This class represents the liveness of a register, or stack slot.
bool hasSubRanges() const
Returns true if subregister liveness information is available.
iterator_range< subrange_iterator > subranges()
bool hasInterval(Register Reg) const
SlotIndexes * getSlotIndexes() const
SlotIndex getInstructionIndex(const MachineInstr &Instr) const
Returns the base index of the given instruction.
LiveRange * getCachedRegUnit(unsigned Unit)
Return the live range for register unit Unit if it has already been computed, or nullptr if it hasn't...
LiveInterval & getInterval(Register Reg)
This class represents the liveness of a register, stack slot, etc.
bool liveAt(SlotIndex index) const
MachineInstrBundleIterator< const MachineInstr > const_iterator
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
Representation of each machine instruction.
filtered_mop_range all_defs()
Returns an iterator range over all operands that are (explicit or implicit) register defs.
MachineOperand class - Representation of each machine instruction operand.
unsigned getSubReg() const
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 ...
Simple wrapper around std::function<void(raw_ostream&)>.
List of registers defined and used by a machine instruction.
SmallVector< VRegMaskOrUnit, 8 > Defs
List of virtual registers and register units defined by the instruction which are not dead.
LLVM_ABI void collect(const MachineInstr &MI, const TargetRegisterInfo &TRI, const MachineRegisterInfo &MRI, bool TrackLaneMasks, bool IgnoreDead)
Analyze the given instruction MI and fill in the Uses, Defs and DeadDefs list based on the MachineOpe...
LLVM_ABI void adjustLaneLiveness(const LiveIntervals &LIS, const MachineRegisterInfo &MRI, SlotIndex Pos, MachineInstr *AddFlagsMI=nullptr)
Use liveness information to find out which uses/defs are partially undefined/dead and adjust the VReg...
SmallVector< VRegMaskOrUnit, 8 > Uses
List of virtual registers and register units read by the instruction.
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.
This class keeps track of the SPI_SP_INPUT_ADDR config register, which tells the hardware which inter...
unsigned getDynamicVGPRBlockSize() const
static unsigned getNumCoveredRegs(LaneBitmask LM)
bool isVectorSuperClass(const TargetRegisterClass *RC) const
static bool isSGPRClass(const TargetRegisterClass *RC)
static bool isAGPRClass(const TargetRegisterClass *RC)
SlotIndex - An opaque wrapper around machine indexes.
SlotIndex getBaseIndex() const
Returns the base index for associated with this index.
SlotIndex getRegSlot(bool EC=false) const
Returns the register use/def slot in the current instruction for a normal or early-clobber def.
SlotIndex getMBBEndIdx(unsigned Num) const
Returns the last index in the given basic block number.
SlotIndex getMBBStartIdx(unsigned Num) const
Returns the first index in the given basic block number.
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
std::pair< const_iterator, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
reference emplace_back(ArgTypes &&... Args)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
A Use represents the edge between a Value definition and its users.
An efficient, type-erasing, non-owning reference to a callable.
This class implements an extremely fast bulk output stream that can only output to a stream.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
LaneBitmask getLiveLaneMask(unsigned Reg, SlotIndex SI, const LiveIntervals &LIS, const MachineRegisterInfo &MRI, LaneBitmask LaneMaskFilter=LaneBitmask::getAll())
bool isEqual(const GCNRPTracker::LiveRegSet &S1, const GCNRPTracker::LiveRegSet &S2)
Printable print(const GCNRegPressure &RP, const GCNSubtarget *ST=nullptr, unsigned DynamicVGPRBlockSize=0)
GCNRegPressure getRegPressure(const MachineRegisterInfo &MRI, Range &&LiveRegs)
Printable PrintLaneMask(LaneBitmask LaneMask)
Create Printable object to print LaneBitmasks on a raw_ostream.
IterT skipDebugInstructionsForward(IterT It, IterT End, bool SkipPseudoOp=true)
Increment It until it points to a non-debug instruction or to End and return the resulting iterator.
GCNRPTracker::LiveRegSet getLiveRegs(SlotIndex SI, const LiveIntervals &LIS, const MachineRegisterInfo &MRI)
GCNRPTracker::LiveRegSet getLiveRegsAfter(const MachineInstr &MI, const LiveIntervals &LIS)
auto reverse(ContainerTy &&C)
LLVM_ABI Printable printVRegOrUnit(unsigned VRegOrUnit, const TargetRegisterInfo *TRI)
Create Printable object to print virtual registers and physical registers on a raw_ostream.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
char & GCNRegPressurePrinterID
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
GCNRPTracker::LiveRegSet getLiveRegsBefore(const MachineInstr &MI, const LiveIntervals &LIS)
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.
Printable reportMismatch(const GCNRPTracker::LiveRegSet &LISLR, const GCNRPTracker::LiveRegSet &TrackedL, const TargetRegisterInfo *TRI, StringRef Pfx=" ")
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
bool runOnMachineFunction(MachineFunction &MF) override
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
unsigned getVGPRTuplesWeight() const
unsigned getVGPRNum(bool UnifiedVGPRFile) const
friend Printable print(const GCNRegPressure &RP, const GCNSubtarget *ST, unsigned DynamicVGPRBlockSize)
void inc(unsigned Reg, LaneBitmask PrevMask, LaneBitmask NewMask, const MachineRegisterInfo &MRI)
unsigned getAGPRNum() const
unsigned getSGPRNum() const
unsigned getSGPRTuplesWeight() const
bool less(const MachineFunction &MF, const GCNRegPressure &O, unsigned MaxOccupancy=std::numeric_limits< unsigned >::max()) const
Compares this GCNRegpressure to O, returning true if this is less.
static constexpr LaneBitmask getAll()
constexpr bool none() const
constexpr bool any() const
static constexpr LaneBitmask getNone()