31 #include "llvm/Config/llvm-config.h" 54 assert((PrevMask & ~NewMask).none() &&
"Must not remove bits");
55 if (PrevMask.
any() || NewMask.
none())
60 for (; PSetI.
isValid(); ++PSetI)
61 CurrSetPressure[*PSetI] += Weight;
69 if (NewMask.
any() || PrevMask.
none())
74 for (; PSetI.
isValid(); ++PSetI) {
75 assert(CurrSetPressure[*PSetI] >= Weight &&
"register pressure underflow");
76 CurrSetPressure[*PSetI] -= Weight;
80 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) 85 for (
unsigned i = 0, e = SetPressure.
size(); i < e; ++i) {
86 if (SetPressure[i] != 0) {
97 dbgs() <<
"Max Pressure: ";
99 dbgs() <<
"Live In: ";
102 if (!
P.LaneMask.all())
107 dbgs() <<
"Live Out: ";
110 if (!
P.LaneMask.all())
119 if (!isTopClosed() || !isBottomClosed()) {
120 dbgs() <<
"Curr Pressure: ";
128 const char *sep =
"";
143 if (PreviousMask.
any() || NewMask.
none())
148 for (; PSetI.
isValid(); ++PSetI) {
149 CurrSetPressure[*PSetI] += Weight;
150 P.MaxSetPressure[*PSetI] =
151 std::max(
P.MaxSetPressure[*PSetI], CurrSetPressure[*PSetI]);
180 if (TopIdx <= NextTop)
188 if (TopPos != PrevTop)
196 if (BottomIdx > PrevBottom)
204 if (BottomPos != PrevBottom)
214 Regs.setUniverse(NumRegUnits + NumVirtRegs);
215 this->NumRegUnits = NumRegUnits;
232 CurrSetPressure.clear();
233 LiveThruPressure.clear();
234 P.MaxSetPressure.clear();
236 if (RequireIntervals)
253 bool TrackLaneMasks,
bool TrackUntiedDefs) {
257 TRI = MF->getSubtarget().getRegisterInfo();
259 MRI = &MF->getRegInfo();
261 this->TrackUntiedDefs = TrackUntiedDefs;
262 this->TrackLaneMasks = TrackLaneMasks;
264 if (RequireIntervals) {
265 assert(lis &&
"IntervalPressure requires LiveIntervals");
270 CurrSetPressure.assign(
TRI->getNumRegPressureSets(), 0);
272 P.MaxSetPressure = CurrSetPressure;
276 UntiedDefs.setUniverse(
MRI->getNumVirtRegs());
281 if (RequireIntervals)
283 return (static_cast<RegionPressure&>(
P).TopPos ==
289 if (RequireIntervals)
291 return (static_cast<RegionPressure&>(
P).BottomPos ==
298 if (IdxPos == MBB->end())
299 return LIS->getMBBEndIdx(MBB);
300 return LIS->getInstructionIndex(*IdxPos).getRegSlot();
305 if (RequireIntervals)
310 assert(
P.LiveInRegs.empty() &&
"inconsistent max pressure result");
311 P.LiveInRegs.reserve(LiveRegs.size());
312 LiveRegs.appendTo(
P.LiveInRegs);
317 if (RequireIntervals)
322 assert(
P.LiveOutRegs.empty() &&
"inconsistent max pressure result");
323 P.LiveOutRegs.reserve(LiveRegs.size());
324 LiveRegs.appendTo(
P.LiveOutRegs);
329 if (!isTopClosed() && !isBottomClosed()) {
330 assert(LiveRegs.size() == 0 &&
"no region boundary");
333 if (!isBottomClosed())
335 else if (!isTopClosed())
345 LiveThruPressure.assign(
TRI->getNumRegPressureSets(), 0);
346 assert(isBottomClosed() &&
"need bottom-up tracking to intialize.");
348 unsigned RegUnit = Pair.
RegUnit;
359 return Other.
RegUnit == RegUnit;
361 if (
I == RegUnits.
end())
368 unsigned RegUnit = Pair.
RegUnit;
371 return Other.
RegUnit == RegUnit;
373 if (I == RegUnits.
end()) {
383 return Other.
RegUnit == RegUnit;
385 if (
I == RegUnits.
end()) {
394 unsigned RegUnit = Pair.
RegUnit;
397 return Other.
RegUnit == RegUnit;
399 if (I != RegUnits.
end()) {
401 if (I->LaneMask.none())
415 if (Property(SR, Pos))
416 Result |= SR.LaneMask;
418 }
else if (Property(LI, Pos)) {
436 bool TrackLaneMasks,
unsigned RegUnit,
452 class RegisterOperandsCollector {
463 : RegOpers(RegOpers),
TRI(TRI),
MRI(MRI), IgnoreDead(IgnoreDead) {}
467 collectOperand(*OperI);
476 collectOperandLanes(*OperI);
490 pushReg(Reg, RegOpers.
Uses);
495 pushReg(Reg, RegOpers.
Uses);
501 pushReg(Reg, RegOpers.
Defs);
505 void pushReg(
unsigned Reg,
518 unsigned Reg = MO.
getReg();
522 pushRegLanes(Reg, SubRegIdx, RegOpers.
Uses);
531 pushRegLanes(Reg, SubRegIdx, RegOpers.
DeadDefs);
533 pushRegLanes(Reg, SubRegIdx, RegOpers.
Defs);
537 void pushRegLanes(
unsigned Reg,
unsigned SubRegIdx,
556 bool TrackLaneMasks,
bool IgnoreDead) {
557 RegisterOperandsCollector
Collector(*
this, TRI, MRI, IgnoreDead);
559 Collector.collectInstrLanes(MI);
561 Collector.collectInstr(MI);
567 for (
auto RI =
Defs.begin(); RI !=
Defs.end(); ) {
568 unsigned Reg = RI->RegUnit;
588 for (
auto I =
Defs.begin();
I !=
Defs.end(); ) {
593 unsigned RegUnit =
I->RegUnit;
595 AddFlagsMI !=
nullptr && (LiveAfter & ~
I->LaneMask).none())
599 if (ActualDef.
none()) {
602 I->LaneMask = ActualDef;
606 for (
auto I =
Uses.begin();
I !=
Uses.end(); ) {
610 if (LaneMask.none()) {
613 I->LaneMask = LaneMask;
617 if (AddFlagsMI !=
nullptr) {
619 unsigned RegUnit =
P.RegUnit;
624 if (LiveAfter.
none())
659 for (; PSetI.
isValid(); ++PSetI) {
676 unsigned NewUnitInc = I->
getUnitInc() + Weight;
677 if (NewUnitInc != 0) {
682 for (J = std::next(I); J !=
E && J->
isValid(); ++J, ++
I)
695 increaseRegPressure(
P.RegUnit, PrevMask, NewMask);
703 unsigned RegUnit = Pair.
RegUnit;
705 return Other.
RegUnit == RegUnit;
709 if (
I == LiveInOrOut.
end()) {
714 PrevMask =
I->LaneMask;
716 I->LaneMask = NewMask;
722 discoverLiveInOrOut(Pair,
P.LiveInRegs);
726 discoverLiveInOrOut(Pair,
P.LiveOutRegs);
731 unsigned Reg =
P.RegUnit;
734 increaseRegPressure(Reg, LiveMask, BumpedMask);
737 unsigned Reg =
P.RegUnit;
740 decreaseRegPressure(Reg, BumpedMask, LiveMask);
751 assert(!CurrPos->isDebugInstr());
770 PreviousMask = LiveOut;
773 if (NewMask.
none()) {
776 if (TrackLaneMasks && LiveUses !=
nullptr)
780 decreaseRegPressure(Reg, PreviousMask, NewMask);
784 if (RequireIntervals)
793 if (NewMask == PreviousMask)
797 if (PreviousMask.none()) {
798 if (LiveUses !=
nullptr) {
799 if (!TrackLaneMasks) {
806 bool IsRedef =
I != LiveUses->
end();
818 if (RequireIntervals) {
819 LaneBitmask LiveOut = getLiveThroughAt(Reg, SlotIdx);
825 increaseRegPressure(Reg, PreviousMask, NewMask);
827 if (TrackUntiedDefs) {
829 unsigned RegUnit = Def.
RegUnit;
831 (LiveRegs.contains(RegUnit) & Def.
LaneMask).none())
832 UntiedDefs.insert(RegUnit);
838 assert(CurrPos != MBB->begin());
839 if (!isBottomClosed())
843 if (!RequireIntervals && isTopClosed())
844 static_cast<RegionPressure&>(
P).openTop(CurrPos);
850 if (RequireIntervals)
854 if (RequireIntervals && isTopClosed())
859 recedeSkipDebugValues();
863 RegOpers.
collect(MI, *
TRI, *MRI, TrackLaneMasks,
false);
864 if (TrackLaneMasks) {
867 }
else if (RequireIntervals) {
871 recede(RegOpers, LiveUses);
876 assert(!TrackUntiedDefs &&
"unsupported mode");
877 assert(CurrPos != MBB->end());
882 if (RequireIntervals)
883 SlotIdx = getCurrSlot();
886 if (isBottomClosed()) {
887 if (RequireIntervals)
899 increaseRegPressure(Reg, LiveMask, LiveMask | LiveIn);
903 if (RequireIntervals) {
904 LaneBitmask LastUseMask = getLastUsedLanes(Reg, SlotIdx);
905 if (LastUseMask.
any()) {
907 decreaseRegPressure(Reg, LiveMask, LiveMask & ~LastUseMask);
916 increaseRegPressure(Def.
RegUnit, PreviousMask, NewMask);
929 RegOpers.
collect(MI, *
TRI, *MRI, TrackLaneMasks,
false);
930 if (TrackLaneMasks) {
944 for (
unsigned i = 0, e = OldPressureVec.
size(); i < e; ++i) {
945 unsigned POld = OldPressureVec[i];
946 unsigned PNew = NewPressureVec[i];
947 int PDiff = (int)PNew - (
int)POld;
952 if (!LiveThruPressureVec.
empty())
953 Limit += LiveThruPressureVec[i];
959 PDiff = PNew - Limit;
960 }
else if (Limit > PNew)
961 PDiff = Limit - POld;
985 unsigned CritIdx = 0, CritEnd = CriticalPSets.
size();
986 for (
unsigned i = 0, e = OldMaxPressureVec.
size(); i < e; ++i) {
987 unsigned POld = OldMaxPressureVec[i];
988 unsigned PNew = NewMaxPressureVec[i];
993 while (CritIdx != CritEnd && CriticalPSets[CritIdx].getPSet() < i)
996 if (CritIdx != CritEnd && CriticalPSets[CritIdx].getPSet() == i) {
997 int PDiff = (int)PNew - (
int)CriticalPSets[CritIdx].getUnitInc();
1025 if (RequireIntervals)
1030 RegOpers.
collect(*MI, *
TRI, *MRI, TrackLaneMasks,
true);
1034 else if (RequireIntervals)
1047 LaneBitmask LiveAfter = (LiveLanes & ~DefLanes) | UseLanes;
1048 decreaseRegPressure(Reg, LiveLanes, LiveAfter);
1055 increaseRegPressure(Reg, LiveLanes, LiveAfter);
1080 std::vector<unsigned> SavedPressure = CurrSetPressure;
1081 std::vector<unsigned> SavedMaxPressure =
P.MaxSetPressure;
1083 bumpUpwardPressure(MI);
1088 MaxPressureLimit, Delta);
1093 P.MaxSetPressure.swap(SavedMaxPressure);
1094 CurrSetPressure.swap(SavedPressure);
1102 getUpwardPressureDelta(MI, *PDiff, Delta2, CriticalPSets, MaxPressureLimit);
1103 if (Delta != Delta2) {
1104 dbgs() <<
"PDiff: ";
1106 dbgs() <<
"DELTA: " << *
MI;
1145 unsigned CritIdx = 0, CritEnd = CriticalPSets.
size();
1147 PDiffI = PDiff.
begin(), PDiffE = PDiff.
end();
1148 PDiffI != PDiffE && PDiffI->
isValid(); ++PDiffI) {
1150 unsigned PSetID = PDiffI->getPSet();
1151 unsigned Limit = RCI->getRegPressureSetLimit(PSetID);
1152 if (!LiveThruPressure.empty())
1153 Limit += LiveThruPressure[PSetID];
1155 unsigned POld = CurrSetPressure[PSetID];
1156 unsigned MOld =
P.MaxSetPressure[PSetID];
1157 unsigned MNew = MOld;
1159 unsigned PNew = POld + PDiffI->getUnitInc();
1160 assert((PDiffI->getUnitInc() >= 0) == (PNew >= POld)
1161 &&
"PSet overflow/underflow");
1166 unsigned ExcessInc = 0;
1168 ExcessInc = POld > Limit ? PNew - POld : PNew - Limit;
1169 else if (POld > Limit)
1170 ExcessInc = Limit - POld;
1180 while (CritIdx != CritEnd && CriticalPSets[CritIdx].getPSet() < PSetID)
1183 if (CritIdx != CritEnd && CriticalPSets[CritIdx].getPSet() == PSetID) {
1184 int CritInc = (int)MNew - (
int)CriticalPSets[CritIdx].getUnitInc();
1212 if (InstSlot >= PriorUseIdx && InstSlot < NextUseIdx) {
1213 unsigned SubRegIdx = MO.getSubReg();
1215 LastUseMask &= ~UseMask;
1216 if (LastUseMask.
none())
1225 assert(RequireIntervals);
1235 assert(RequireIntervals);
1246 assert(RequireIntervals);
1266 if (RequireIntervals)
1271 RegOpers.
collect(*MI, *
TRI, *MRI, TrackLaneMasks,
false);
1275 if (RequireIntervals) {
1278 LaneBitmask LastUseMask = getLastUsedLanes(Reg, SlotIdx);
1279 if (LastUseMask.
none())
1289 if (LastUseMask.
none())
1294 decreaseRegPressure(Reg, LiveMask, NewMask);
1303 increaseRegPressure(Reg, LiveMask, NewMask);
1326 std::vector<unsigned> SavedPressure = CurrSetPressure;
1327 std::vector<unsigned> SavedMaxPressure =
P.MaxSetPressure;
1329 bumpDownwardPressure(MI);
1334 MaxPressureLimit, Delta);
1339 P.MaxSetPressure.swap(SavedMaxPressure);
1340 CurrSetPressure.swap(SavedPressure);
1346 std::vector<unsigned> &PressureResult,
1347 std::vector<unsigned> &MaxPressureResult) {
1349 PressureResult = CurrSetPressure;
1350 MaxPressureResult =
P.MaxSetPressure;
1352 bumpUpwardPressure(MI);
1355 P.MaxSetPressure.swap(MaxPressureResult);
1356 CurrSetPressure.swap(PressureResult);
1362 std::vector<unsigned> &PressureResult,
1363 std::vector<unsigned> &MaxPressureResult) {
1365 PressureResult = CurrSetPressure;
1366 MaxPressureResult =
P.MaxSetPressure;
1368 bumpDownwardPressure(MI);
1371 P.MaxSetPressure.swap(MaxPressureResult);
1372 CurrSetPressure.swap(PressureResult);
void addInstruction(unsigned Idx, const RegisterOperands &RegOpers, const MachineRegisterInfo &MRI)
Record pressure difference induced by the given operand list to node with index Idx.
void push_back(const T &Elt)
static void decreaseSetPressure(std::vector< unsigned > &CurrSetPressure, const MachineRegisterInfo &MRI, unsigned Reg, LaneBitmask PrevMask, LaneBitmask NewMask)
Decrease pressure for each pressure set provided by TargetRegisterInfo.
A common definition of LaneBitmask for use in TableGen and CodeGen.
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
void detectDeadDefs(const MachineInstr &MI, const LiveIntervals &LIS)
Use liveness information to find dead defs not marked with a dead flag and move them to the DeadDefs ...
SlotIndex getBaseIndex() const
Returns the base index for associated with this index.
void bumpDeadDefs(ArrayRef< RegisterMaskPair > DeadDefs)
bool isAllocatable(unsigned PhysReg) const
isAllocatable - Returns true when PhysReg belongs to an allocatable register class and it hasn't been...
LaneBitmask getMaxLaneMaskForVReg(unsigned Reg) const
Returns a mask covering all bits that can appear in lane masks of subregisters of the virtual registe...
Compute iterated dominance frontiers using a linear time algorithm.
void addPressureChange(unsigned RegUnit, bool IsDec, const MachineRegisterInfo *MRI)
Add a change in pressure to the pressure diff of a given instruction.
void init(unsigned N)
Initialize an array of N PressureDiffs.
static const LiveRange * getLiveRange(const LiveIntervals &LIS, unsigned Reg)
void setRegisterDefReadUndef(unsigned Reg, bool IsUndef=true)
Mark all subregister defs of register Reg with the undef flag.
void decreaseRegPressure(unsigned RegUnit, LaneBitmask PreviousMask, LaneBitmask NewMask)
LiveInterval - This class represents the liveness of a register, or stack slot.
iterator_range< use_nodbg_iterator > use_nodbg_operands(unsigned Reg) const
unsigned getReg() const
getReg - Returns the register number.
static bool isVirtualRegister(unsigned Reg)
Return true if the specified register number is in the virtual register namespace.
unsigned getSubReg() const
void dump(const TargetRegisterInfo *TRI) const
unsigned RegUnit
Virtual register or register unit.
SmallVector< RegisterMaskPair, 8 > DeadDefs
List of virtual registers and register units defined by the instruction but dead. ...
bool isDeadDef() const
Return true if this instruction has a dead def.
A live range for subregisters.
This represents a simple continuous liveness interval for a value.
unsigned const TargetRegisterInfo * TRI
Printable PrintLaneMask(LaneBitmask LaneMask)
Create Printable object to print LaneBitmasks on a raw_ostream.
void closeRegion()
Finalize the region boundaries and recored live ins and live outs.
static void increaseSetPressure(std::vector< unsigned > &CurrSetPressure, const MachineRegisterInfo &MRI, unsigned Reg, LaneBitmask PrevMask, LaneBitmask NewMask)
Increase pressure for each pressure set provided by TargetRegisterInfo.
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds...
MachineInstrBundleIterator< const MachineInstr > const_iterator
void openBottom(MachineBasicBlock::const_iterator PrevBottom)
If the current bottom is the previous instr (before advancing), open it.
unsigned getRegPressureSetLimit(unsigned Idx) const
Get the register unit limit for the given pressure set index.
static LaneBitmask getLiveLanesAt(const LiveIntervals &LIS, const MachineRegisterInfo &MRI, bool TrackLaneMasks, unsigned RegUnit, SlotIndex Pos)
bool isInternalRead() const
void discoverLiveInOrOut(RegisterMaskPair Pair, SmallVectorImpl< RegisterMaskPair > &LiveInOrOut)
This class represents the liveness of a register, stack slot, etc.
void recede(SmallVectorImpl< RegisterMaskPair > *LiveUses=nullptr)
Recede across the previous instruction.
LaneBitmask getLastUsedLanes(unsigned RegUnit, SlotIndex Pos) const
void discoverLiveIn(RegisterMaskPair Pair)
Add Reg to the live in set and increase max pressure.
void closeBottom()
Set the boundary for the bottom of the region and summarize live outs.
SlotIndex getDeadSlot() const
Returns the dead def kill slot for the current instruction.
virtual const char * getRegPressureSetName(unsigned Idx) const =0
Get the name of this register unit pressure set.
A Use represents the edge between a Value definition and its users.
void openBottom(SlotIndex PrevBottom)
If the current bottom is not greater than the previous index, open it.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
iterator_range< subrange_iterator > subranges()
Result of a LiveRange query.
static constexpr LaneBitmask getAll()
bool hasSubRanges() const
Returns true if subregister liveness information is available.
static constexpr LaneBitmask getNone()
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).
bool isBottomClosed() const
Does this pressure result have a valid bottom position and live outs.
bool readsReg() const
readsReg - Returns true if this operand reads the previous value of its register. ...
bool isValid() const
isValid - Returns true until all the operands have been visited.
void openTop(SlotIndex NextTop)
If the current top is not less than or equal to the next index, open it.
SlotIndex getRegSlot(bool EC=false) const
Returns the register use/def slot in the current instruction for a normal or early-clobber def...
SmallVector< RegisterMaskPair, 8 > LiveInRegs
List of live in virtual registers or physical register units.
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...
List of registers defined and used by a machine instruction.
SlotIndex getCurrSlot() const
Get the SlotIndex for the first nondebug instruction including or after the current position...
void increaseRegPressure(unsigned RegUnit, LaneBitmask PreviousMask, LaneBitmask NewMask)
LiveRange * getCachedRegUnit(unsigned Unit)
Return the live range for register unit Unit if it has already been computed, or nullptr if it hasn't...
const_iterator end() const
LiveQueryResult Query(SlotIndex Idx) const
Query Liveness at Idx.
void recedeSkipDebugValues()
Recede until we find an instruction which is not a DebugValue.
void init(const MachineRegisterInfo &MRI)
SmallVector< RegisterMaskPair, 8 > LiveOutRegs
void addLiveRegs(ArrayRef< RegisterMaskPair > Regs)
Force liveness of virtual registers or physical register units.
void getMaxDownwardPressureDelta(const MachineInstr *MI, RegPressureDelta &Delta, ArrayRef< PressureChange > CriticalPSets, ArrayRef< unsigned > MaxPressureLimit)
Consider the pressure increase caused by traversing this instruction top-down.
SmallVector< RegisterMaskPair, 8 > Uses
List of virtual registers and register units read by the instruction.
unsigned getNumRegs() const
Return the number of registers this target has (useful for sizing arrays holding per register informa...
const TargetRegisterInfo * getTargetRegisterInfo() const
unsigned const MachineRegisterInfo * MRI
PressureChange CurrentMax
RegisterPressure computed within a region of instructions delimited by TopIdx and BottomIdx...
bool liveAt(SlotIndex index) const
void bumpDownwardPressure(const MachineInstr *MI)
Record the downward impact of a single instruction on current register pressure.
size_t size() const
size - Get the array size.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
void getUpwardPressureDelta(const MachineInstr *MI, PressureDiff &PDiff, RegPressureDelta &Delta, ArrayRef< PressureChange > CriticalPSets, ArrayRef< unsigned > MaxPressureLimit) const
This is the fast version of querying register pressure that does not directly depend on current liven...
Printable printVRegOrUnit(unsigned VRegOrUnit, const TargetRegisterInfo *TRI)
Create Printable object to print virtual registers and physical registers on a raw_ostream.
RegisterPressure computed within a region of instructions delimited by TopPos and BottomPos...
void openTop(MachineBasicBlock::const_iterator PrevTop)
If the current top is the previous instruction (before receding), open it.
LaneBitmask getLiveThroughAt(unsigned RegUnit, SlotIndex Pos) const
constexpr bool none() const
Track the current register pressure at some position in the instruction stream, and remember the high...
List of PressureChanges in order of increasing, unique PSetID.
auto find_if(R &&Range, UnaryPredicate P) -> decltype(adl_begin(Range))
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly...
unsigned getNumVirtRegs() const
getNumVirtRegs - Return the number of virtual registers created.
SmallVector< RegisterMaskPair, 8 > Defs
List of virtual registers and register units defined by the instruction which are not dead...
void discoverLiveOut(RegisterMaskPair Pair)
Add Reg to the live out set and increase max pressure.
iterator erase(const_iterator CI)
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
bool hasUntiedDef(unsigned VirtReg) const
bool isDebugInstr() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void initLiveThru(const RegPressureTracker &RPTracker)
Initialize the LiveThru pressure set based on the untied defs found in RPTracker. ...
std::vector< unsigned > MaxSetPressure
Map of max reg pressure indexed by pressure set ID, not class ID.
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 Regi...
void advance()
Advance across the current instruction.
ConstMIBundleOperands - Iterate over all operands in a const bundle of machine instructions.
MachineOperand class - Representation of each machine instruction operand.
bool isTopClosed() const
Does this pressure result have a valid top position and live ins.
static LaneBitmask getRegLanes(ArrayRef< RegisterMaskPair > RegUnits, unsigned RegUnit)
void reset()
Clear the result so it can be used for another round of pressure tracking.
LaneBitmask getSubRegIndexLaneMask(unsigned SubIdx) const
Return a bitmask representing the parts of a register that are covered by SubIdx. ...
LiveInterval & getInterval(unsigned Reg)
IterT skipDebugInstructionsBackward(IterT It, IterT Begin)
Decrement It until it points to a non-debug instruction or to Begin and return the resulting iterator...
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
static void addRegLanes(SmallVectorImpl< RegisterMaskPair > &RegUnits, RegisterMaskPair Pair)
PressureChange CriticalMax
bool isValid() const
isValid - returns true if this iterator is not yet at the end.
static LaneBitmask getLanesWithProperty(const LiveIntervals &LIS, const MachineRegisterInfo &MRI, bool TrackLaneMasks, unsigned RegUnit, SlotIndex Pos, LaneBitmask SafeDefault, bool(*Property)(const LiveRange &LR, SlotIndex Pos))
IterT skipDebugInstructionsForward(IterT It, IterT End)
Increment It until it points to a non-debug instruction or to End and return the resulting iterator...
SlotIndex getInstructionIndex(const MachineInstr &Instr) const
Returns the base index of the given instruction.
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
void closeTop()
Set the boundary for the top of the region and summarize live ins.
Representation of each machine instruction.
void dump(const TargetRegisterInfo &TRI) const
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
void dumpRegSetPressure(ArrayRef< unsigned > SetPressure, const TargetRegisterInfo *TRI)
static void removeRegLanes(SmallVectorImpl< RegisterMaskPair > &RegUnits, RegisterMaskPair Pair)
Iterate over the pressure sets affected by the given physical or virtual register.
PSetIterator getPressureSets(unsigned RegUnit) const
Get an iterator over the pressure sets affected by the given physical or virtual register.
constexpr bool any() const
Capture a change in pressure for a single pressure set.
void getMaxUpwardPressureDelta(const MachineInstr *MI, PressureDiff *PDiff, RegPressureDelta &Delta, ArrayRef< PressureChange > CriticalPSets, ArrayRef< unsigned > MaxPressureLimit)
Consider the pressure increase caused by traversing this instruction bottom-up.
void getUpwardPressure(const MachineInstr *MI, std::vector< unsigned > &PressureResult, std::vector< unsigned > &MaxPressureResult)
Get the pressure of each PSet after traversing this instruction bottom-up.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
void init(const MachineFunction *mf, const RegisterClassInfo *rci, const LiveIntervals *lis, const MachineBasicBlock *mbb, MachineBasicBlock::const_iterator pos, bool TrackLaneMasks, bool TrackUntiedDefs)
Setup the RegPressureTracker.
const Segment * getSegmentContaining(SlotIndex Idx) const
Return the segment that contains the specified index, or null if there is none.
void bumpUpwardPressure(const MachineInstr *MI)
Record the upward impact of a single instruction on current register pressure.
Store the effects of a change in pressure on things that MI scheduler cares about.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static void setRegZero(SmallVectorImpl< RegisterMaskPair > &RegUnits, unsigned RegUnit)
const_iterator begin() const
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
static void computeMaxPressureDelta(ArrayRef< unsigned > OldMaxPressureVec, ArrayRef< unsigned > NewMaxPressureVec, ArrayRef< PressureChange > CriticalPSets, ArrayRef< unsigned > MaxPressureLimit, RegPressureDelta &Delta)
Find the max change in max pressure that either surpasses a critical PSet limit or exceeds the curren...
void reset()
Clear the result so it can be used for another round of pressure tracking.
void getDownwardPressure(const MachineInstr *MI, std::vector< unsigned > &PressureResult, std::vector< unsigned > &MaxPressureResult)
Get the pressure of each PSet after traversing this instruction top-down.
LLVM_ATTRIBUTE_RETURNS_NONNULL void * safe_calloc(size_t Count, size_t Sz)
LaneBitmask getLiveLanesAt(unsigned RegUnit, SlotIndex Pos) const
unsigned getWeight() const
SlotIndex - An opaque wrapper around machine indexes.
Register Usage Information Collector
bool empty() const
empty - Check if the array is empty.
static void computeExcessPressureDelta(ArrayRef< unsigned > OldPressureVec, ArrayRef< unsigned > NewPressureVec, RegPressureDelta &Delta, const RegisterClassInfo *RCI, ArrayRef< unsigned > LiveThruPressureVec)
Find the max change in excess pressure across all sets.