53 assert((PrevMask & ~NewMask).none() &&
"Must not remove bits");
54 if (PrevMask.
any() || NewMask.
none())
59 for (; PSetI.
isValid(); ++PSetI)
60 CurrSetPressure[*PSetI] += Weight;
68 if (NewMask.
any() || PrevMask.
none())
73 for (; PSetI.
isValid(); ++PSetI) {
74 assert(CurrSetPressure[*PSetI] >= Weight &&
"register pressure underflow");
75 CurrSetPressure[*PSetI] -= Weight;
79 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
84 for (
unsigned i = 0, e = SetPressure.
size(); i < e; ++i) {
85 if (SetPressure[i] != 0) {
96 dbgs() <<
"Max Pressure: ";
98 dbgs() <<
"Live In: ";
101 if (!
P.LaneMask.all())
106 dbgs() <<
"Live Out: ";
109 if (!
P.LaneMask.all())
119 dbgs() <<
"Curr Pressure: ";
127 const char *sep =
"";
142 if (PreviousMask.
any() || NewMask.
none())
147 for (; PSetI.
isValid(); ++PSetI) {
148 CurrSetPressure[*PSetI] += Weight;
214 this->NumRegUnits = NumRegUnits;
231 CurrSetPressure.clear();
232 LiveThruPressure.clear();
235 if (RequireIntervals)
252 bool TrackLaneMasks,
bool TrackUntiedDefs) {
260 this->TrackUntiedDefs = TrackUntiedDefs;
261 this->TrackLaneMasks = TrackLaneMasks;
263 if (RequireIntervals) {
264 assert(lis &&
"IntervalPressure requires LiveIntervals");
280 if (RequireIntervals)
282 return (static_cast<RegionPressure&>(P).TopPos ==
288 if (RequireIntervals)
290 return (static_cast<RegionPressure&>(P).BottomPos ==
297 if (IdxPos == MBB->
end())
304 if (RequireIntervals)
316 if (RequireIntervals)
329 assert(LiveRegs.
size() == 0 &&
"no region boundary");
347 unsigned RegUnit = Pair.
RegUnit;
358 return Other.
RegUnit == RegUnit;
360 if (
I == RegUnits.
end())
367 unsigned RegUnit = Pair.
RegUnit;
370 return Other.
RegUnit == RegUnit;
372 if (I == RegUnits.
end()) {
382 return Other.
RegUnit == RegUnit;
384 if (
I == RegUnits.
end()) {
393 unsigned RegUnit = Pair.
RegUnit;
396 return Other.
RegUnit == RegUnit;
398 if (I != RegUnits.
end()) {
400 if (I->LaneMask.none())
414 if (Property(SR, Pos))
415 Result |= SR.LaneMask;
417 }
else if (Property(LI, Pos)) {
435 bool TrackLaneMasks,
unsigned RegUnit,
451 class RegisterOperandsCollector {
462 : RegOpers(RegOpers), TRI(TRI), MRI(MRI), IgnoreDead(IgnoreDead) {}
466 collectOperand(*OperI);
475 collectOperandLanes(*OperI);
489 pushReg(Reg, RegOpers.Uses);
494 pushReg(Reg, RegOpers.Uses);
498 pushReg(Reg, RegOpers.DeadDefs);
500 pushReg(Reg, RegOpers.Defs);
504 void pushReg(
unsigned Reg,
517 unsigned Reg = MO.
getReg();
521 pushRegLanes(Reg, SubRegIdx, RegOpers.Uses);
530 pushRegLanes(Reg, SubRegIdx, RegOpers.DeadDefs);
532 pushRegLanes(Reg, SubRegIdx, RegOpers.Defs);
536 void pushRegLanes(
unsigned Reg,
unsigned SubRegIdx,
540 ? TRI.getSubRegIndexLaneMask(SubRegIdx)
555 bool TrackLaneMasks,
bool IgnoreDead) {
556 RegisterOperandsCollector
Collector(*
this, TRI, MRI, IgnoreDead);
558 Collector.collectInstrLanes(MI);
560 Collector.collectInstr(MI);
566 for (
auto RI =
Defs.begin(); RI !=
Defs.end(); ) {
567 unsigned Reg = RI->RegUnit;
587 for (
auto I =
Defs.begin();
I !=
Defs.end(); ) {
592 unsigned RegUnit =
I->RegUnit;
594 AddFlagsMI !=
nullptr && (LiveAfter & ~
I->LaneMask).none())
598 if (ActualDef.
none()) {
601 I->LaneMask = ActualDef;
605 for (
auto I =
Uses.begin();
I !=
Uses.end(); ) {
609 if (LaneMask.none()) {
612 I->LaneMask = LaneMask;
616 if (AddFlagsMI !=
nullptr) {
618 unsigned RegUnit =
P.RegUnit;
623 if (LiveAfter.
none())
658 for (; PSetI.
isValid(); ++PSetI) {
675 unsigned NewUnitInc = I->
getUnitInc() + Weight;
676 if (NewUnitInc != 0) {
681 for (J = std::next(I); J !=
E && J->
isValid(); ++J, ++
I)
702 unsigned RegUnit = Pair.
RegUnit;
704 return Other.
RegUnit == RegUnit;
708 if (
I == LiveInOrOut.
end()) {
713 PrevMask =
I->LaneMask;
715 I->LaneMask = NewMask;
730 unsigned Reg =
P.RegUnit;
736 unsigned Reg =
P.RegUnit;
750 assert(!CurrPos->isDebugValue());
769 PreviousMask = LiveOut;
772 if (NewMask.
none()) {
775 if (TrackLaneMasks && LiveUses !=
nullptr)
783 if (RequireIntervals)
792 if (NewMask == PreviousMask)
796 if (PreviousMask.none()) {
797 if (LiveUses !=
nullptr) {
798 if (!TrackLaneMasks) {
805 bool IsRedef =
I != LiveUses->
end();
817 if (RequireIntervals) {
826 if (TrackUntiedDefs) {
828 unsigned RegUnit = Def.
RegUnit;
831 UntiedDefs.insert(RegUnit);
843 static_cast<RegionPressure&>(
P).openTop(CurrPos);
849 if (RequireIntervals)
862 RegOpers.
collect(MI, *TRI, *MRI, TrackLaneMasks,
false);
863 if (TrackLaneMasks) {
866 }
else if (RequireIntervals) {
870 recede(RegOpers, LiveUses);
875 assert(!TrackUntiedDefs &&
"unsupported mode");
881 if (RequireIntervals)
886 if (RequireIntervals)
902 if (RequireIntervals) {
904 if (LastUseMask.
any()) {
928 RegOpers.
collect(MI, *TRI, *MRI, TrackLaneMasks,
false);
929 if (TrackLaneMasks) {
943 for (
unsigned i = 0, e = OldPressureVec.
size(); i < e; ++i) {
944 unsigned POld = OldPressureVec[i];
945 unsigned PNew = NewPressureVec[i];
946 int PDiff = (int)PNew - (
int)POld;
951 if (!LiveThruPressureVec.
empty())
952 Limit += LiveThruPressureVec[i];
958 PDiff = PNew - Limit;
959 }
else if (Limit > PNew)
960 PDiff = Limit - POld;
984 unsigned CritIdx = 0, CritEnd = CriticalPSets.
size();
985 for (
unsigned i = 0, e = OldMaxPressureVec.
size(); i < e; ++i) {
986 unsigned POld = OldMaxPressureVec[i];
987 unsigned PNew = NewMaxPressureVec[i];
992 while (CritIdx != CritEnd && CriticalPSets[CritIdx].getPSet() < i)
995 if (CritIdx != CritEnd && CriticalPSets[CritIdx].getPSet() == i) {
996 int PDiff = (int)PNew - (
int)CriticalPSets[CritIdx].getUnitInc();
1024 if (RequireIntervals)
1029 RegOpers.
collect(*MI, *TRI, *MRI, TrackLaneMasks,
true);
1033 else if (RequireIntervals)
1046 LaneBitmask LiveAfter = (LiveLanes & ~DefLanes) | UseLanes;
1079 std::vector<unsigned> SavedPressure = CurrSetPressure;
1080 std::vector<unsigned> SavedMaxPressure =
P.MaxSetPressure;
1087 MaxPressureLimit, Delta);
1092 P.MaxSetPressure.swap(SavedMaxPressure);
1093 CurrSetPressure.swap(SavedPressure);
1102 if (Delta != Delta2) {
1103 dbgs() <<
"PDiff: ";
1105 dbgs() <<
"DELTA: " << *
MI;
1144 unsigned CritIdx = 0, CritEnd = CriticalPSets.
size();
1146 PDiffI = PDiff.
begin(), PDiffE = PDiff.
end();
1147 PDiffI != PDiffE && PDiffI->
isValid(); ++PDiffI) {
1149 unsigned PSetID = PDiffI->getPSet();
1151 if (!LiveThruPressure.empty())
1152 Limit += LiveThruPressure[PSetID];
1154 unsigned POld = CurrSetPressure[PSetID];
1155 unsigned MOld =
P.MaxSetPressure[PSetID];
1156 unsigned MNew = MOld;
1158 unsigned PNew = POld + PDiffI->getUnitInc();
1159 assert((PDiffI->getUnitInc() >= 0) == (PNew >= POld)
1160 &&
"PSet overflow/underflow");
1165 unsigned ExcessInc = 0;
1167 ExcessInc = POld > Limit ? PNew - POld : PNew - Limit;
1168 else if (POld > Limit)
1169 ExcessInc = Limit - POld;
1179 while (CritIdx != CritEnd && CriticalPSets[CritIdx].getPSet() < PSetID)
1182 if (CritIdx != CritEnd && CriticalPSets[CritIdx].getPSet() == PSetID) {
1183 int CritInc = (int)MNew - (
int)CriticalPSets[CritIdx].getUnitInc();
1211 if (InstSlot >= PriorUseIdx && InstSlot < NextUseIdx) {
1214 LastUseMask &= ~UseMask;
1215 if (LastUseMask.
none())
1224 assert(RequireIntervals);
1234 assert(RequireIntervals);
1245 assert(RequireIntervals);
1265 if (RequireIntervals)
1270 RegOpers.
collect(*MI, *TRI, *MRI, TrackLaneMasks,
false);
1274 if (RequireIntervals) {
1278 if (LastUseMask.
none())
1288 if (LastUseMask.
none())
1325 std::vector<unsigned> SavedPressure = CurrSetPressure;
1326 std::vector<unsigned> SavedMaxPressure =
P.MaxSetPressure;
1333 MaxPressureLimit, Delta);
1338 P.MaxSetPressure.swap(SavedMaxPressure);
1339 CurrSetPressure.swap(SavedPressure);
1345 std::vector<unsigned> &PressureResult,
1346 std::vector<unsigned> &MaxPressureResult) {
1348 PressureResult = CurrSetPressure;
1349 MaxPressureResult =
P.MaxSetPressure;
1354 P.MaxSetPressure.swap(MaxPressureResult);
1355 CurrSetPressure.swap(PressureResult);
1361 std::vector<unsigned> &PressureResult,
1362 std::vector<unsigned> &MaxPressureResult) {
1364 PressureResult = CurrSetPressure;
1365 MaxPressureResult =
P.MaxSetPressure;
1370 P.MaxSetPressure.swap(MaxPressureResult);
1371 CurrSetPressure.swap(PressureResult);
void dump(const TargetRegisterInfo *TRI) const
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.
const Segment * getSegmentContaining(SlotIndex Idx) const
Return the segment that contains the specified index, or null if there is none.
MachineInstr * getParent()
getParent - Return the instruction that this operand belongs to.
virtual unsigned getNumRegPressureSets() const =0
Get the number of dimensions of register pressure.
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 ...
void bumpDeadDefs(ArrayRef< RegisterMaskPair > DeadDefs)
void addPressureChange(unsigned RegUnit, bool IsDec, const MachineRegisterInfo *MRI)
Add a change in pressure to the pressure diff of a given instruction.
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds...
bool isValid() const
isValid - returns true if this iterator is not yet at the end.
void init(unsigned N)
Initialize an array of N PressureDiffs.
static const LiveRange * getLiveRange(const LiveIntervals &LIS, unsigned Reg)
SlotIndex getBaseIndex() const
Returns the base index for associated with this index.
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)
static LaneBitmask getAll()
void appendTo(ContainerT &To) const
LiveInterval - This class represents the liveness of a register, or stack slot.
static bool isVirtualRegister(unsigned Reg)
Return true if the specified register number is in the virtual register namespace.
SlotIndex getMBBEndIdx(const MachineBasicBlock *mbb) const
Return the last index in the given basic block.
unsigned RegUnit
Virtual register or register unit.
SmallVector< RegisterMaskPair, 8 > DeadDefs
List of virtual registers and register units defined by the instruction but dead. ...
SlotIndex getInstructionIndex(const MachineInstr &Instr) const
Returns the base index of the given instruction.
A live range for subregisters.
This represents a simple continuous liveness interval for a value.
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.
MachineInstrBundleIterator< const MachineInstr > const_iterator
bool isTopClosed() const
Does this pressure result have a valid top position and live ins.
void openBottom(MachineBasicBlock::const_iterator PrevBottom)
If the current bottom is the previous instr (before advancing), open it.
LaneBitmask getSubRegIndexLaneMask(unsigned SubIdx) const
Return a bitmask representing the parts of a register that are covered by SubIdx. ...
static LaneBitmask getLiveLanesAt(const LiveIntervals &LIS, const MachineRegisterInfo &MRI, bool TrackLaneMasks, unsigned RegUnit, SlotIndex Pos)
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.
unsigned getNumVirtRegs() const
getNumVirtRegs - Return the number of virtual registers created.
void discoverLiveIn(RegisterMaskPair Pair)
Add Reg to the live in set and increase max pressure.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
SlotIndex TopIdx
Record the boundary of the region being tracked.
void closeBottom()
Set the boundary for the bottom of the region and summarize live outs.
const TargetRegisterInfo * getTargetRegisterInfo() const
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.
MachineBasicBlock::const_iterator TopPos
Record the boundary of the region being tracked.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
bool isReg() const
isReg - Tests if this is a MO_Register operand.
iterator_range< subrange_iterator > subranges()
Result of a LiveRange query.
Reg
All possible values of the reg field in the ModR/M byte.
SlotIndex getDeadSlot() const
Returns the dead def kill slot for the current instruction.
constexpr bool any() const
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).
SlotIndex getCurrSlot() const
Get the SlotIndex for the first nondebug instruction including or after the current position...
unsigned getNumRegs() const
Return the number of registers this target has (useful for sizing arrays holding per register informa...
const_iterator end() const
void openTop(SlotIndex NextTop)
If the current top is not less than or equal to the next index, open it.
bool hasUntiedDef(unsigned VirtReg) const
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.
size_t size() const
size - Get the array size.
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...
bool isDebugValue() const
void recedeSkipDebugValues()
Recede until we find an instruction which is not a DebugValue.
LaneBitmask getLiveLanesAt(unsigned RegUnit, SlotIndex Pos) const
void init(const MachineRegisterInfo &MRI)
bool isDeadDef() const
Return true if this instruction has a dead def.
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.
LaneBitmask getLiveThroughAt(unsigned RegUnit, SlotIndex Pos) const
LiveQueryResult Query(SlotIndex Idx) const
Query Liveness at Idx.
unsigned const MachineRegisterInfo * MRI
PressureChange CurrentMax
RegisterPressure computed within a region of instructions delimited by TopIdx and BottomIdx...
iterator_range< use_nodbg_iterator > use_nodbg_operands(unsigned Reg) const
constexpr bool none() const
void bumpDownwardPressure(const MachineInstr *MI)
Record the downward impact of a single instruction on current register pressure.
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.
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.
unsigned getRegPressureSetLimit(unsigned Idx) const
Get the register unit limit for the given pressure set index.
void setUniverse(unsigned U)
setUniverse - Set the universe size which determines the largest key the set can hold.
bool empty() const
empty - Check if the array is empty.
SmallVector< RegisterMaskPair, 8 > Defs
List of virtual registers and register units defined by the instruction which are not dead...
unsigned getSubReg() const
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 liveAt(SlotIndex index) const
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.
void dump(const TargetRegisterInfo &TRI) const
MachineOperand class - Representation of each machine instruction operand.
LaneBitmask erase(RegisterMaskPair Pair)
Clears the Pair.LaneMask lanes of Pair.Reg (mark them as dead).
static LaneBitmask getNone()
bool isAllocatable(unsigned PhysReg) const
isAllocatable - Returns true when PhysReg belongs to an allocatable register class and it hasn't been...
unsigned getWeight() const
LaneBitmask getLastUsedLanes(unsigned RegUnit, SlotIndex Pos) const
static LaneBitmask getRegLanes(ArrayRef< RegisterMaskPair > RegUnits, unsigned RegUnit)
void reset()
Clear the result so it can be used for another round of pressure tracking.
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
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...
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
llvm_unreachable("Unknown RegBank!")
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
LaneBitmask contains(unsigned Reg) const
void closeTop()
Set the boundary for the top of the region and summarize live ins.
Representation of each machine instruction.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
void dumpRegSetPressure(ArrayRef< unsigned > SetPressure, const TargetRegisterInfo *TRI)
static void removeRegLanes(SmallVectorImpl< RegisterMaskPair > &RegUnits, RegisterMaskPair Pair)
LaneBitmask getMaxLaneMaskForVReg(unsigned Reg) const
Returns a mask covering all bits that can appear in lane masks of subregisters of the virtual registe...
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
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.
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.
const_iterator begin() const
void clear()
clear - Clears the set.
bool isBottomClosed() const
Does this pressure result have a valid bottom position and live outs.
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.
void bumpUpwardPressure(const MachineInstr *MI)
Record the upward impact of a single instruction on current register pressure.
SlotIndex getRegSlot(bool EC=false) const
Returns the register use/def slot in the current instruction for a normal or early-clobber def...
unsigned getReg() const
getReg - Returns the register number.
bool isValid() const
isValid - Returns true until all the operands have been visited.
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)
LaneBitmask insert(RegisterMaskPair Pair)
Mark the Pair.LaneMask lanes of Pair.Reg as live.
static LLVM_ATTRIBUTE_UNUSED Printable PrintLaneMask(LaneBitmask LaneMask)
Create Printable object to print LaneBitmasks on a raw_ostream.
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.
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
bool readsReg() const
readsReg - Returns true if this operand reads the previous value of its register. ...
MachineBasicBlock::const_iterator BottomPos
auto find_if(R &&Range, UnaryPredicate P) -> decltype(std::begin(Range))
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly...
bool hasSubRanges() const
Returns true if subregister liveness information is available.
SlotIndex - An opaque wrapper around machine indexes.
Printable PrintVRegOrUnit(unsigned VRegOrUnit, const TargetRegisterInfo *TRI)
Create Printable object to print virtual registers and physical registers on a raw_ostream.
Register Usage Information Collector
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...
bool isInternalRead() const
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.