class RegPressureTracker
Declaration
class RegPressureTracker { /* full declaration omitted */ };
Description
Track the current register pressure at some position in the instruction stream, and remember the high water mark within the region traversed. This does not automatically consider live-through ranges. The client may independently adjust for global liveness. Each RegPressureTracker only works within a MachineBasicBlock. Pressure can be tracked across a larger region by storing a RegisterPressure result at each block boundary and explicitly adjusting pressure to account for block live-in and live-out register sets. RegPressureTracker holds a reference to a RegisterPressure result that it computes incrementally. During downward tracking, P.BottomIdx or P.BottomPos is invalid until it reaches the end of the block or closeRegion() is explicitly called. Similarly, P.TopIdx is invalid during upward tracking. Changing direction has the side effect of closing region, and traversing past TopIdx or BottomIdx reopens it.
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:358
Method Overview
- public RegPressureTracker(llvm::RegionPressure & rp)
- public RegPressureTracker(llvm::IntervalPressure & rp)
- public void addLiveRegs(ArrayRef<llvm::RegisterMaskPair> Regs)
- public void advance(const llvm::RegisterOperands & RegOpers)
- public void advance()
- protected void bumpDeadDefs(ArrayRef<llvm::RegisterMaskPair> DeadDefs)
- protected void bumpDownwardPressure(const llvm::MachineInstr * MI)
- protected void bumpUpwardPressure(const llvm::MachineInstr * MI)
- public void closeBottom()
- public void closeRegion()
- public void closeTop()
- protected void decreaseRegPressure(unsigned int RegUnit, llvm::LaneBitmask PreviousMask, llvm::LaneBitmask NewMask)
- protected void discoverLiveIn(llvm::RegisterMaskPair Pair)
- protected void discoverLiveInOrOut(llvm::RegisterMaskPair Pair, SmallVectorImpl<llvm::RegisterMaskPair> & LiveInOrOut)
- protected void discoverLiveOut(llvm::RegisterMaskPair Pair)
- public void dump() const
- protected llvm::SlotIndex getCurrSlot() const
- public void getDownwardPressure(const llvm::MachineInstr * MI, std::vector<unsigned int> & PressureResult, std::vector<unsigned int> & MaxPressureResult)
- protected llvm::LaneBitmask getLastUsedLanes(unsigned int RegUnit, llvm::SlotIndex Pos) const
- protected llvm::LaneBitmask getLiveLanesAt(unsigned int RegUnit, llvm::SlotIndex Pos) const
- protected llvm::LaneBitmask getLiveThroughAt(unsigned int RegUnit, llvm::SlotIndex Pos) const
- public ArrayRef<unsigned int> getLiveThru() const
- public void getMaxDownwardPressureDelta(const llvm::MachineInstr * MI, llvm::RegPressureDelta & Delta, ArrayRef<llvm::PressureChange> CriticalPSets, ArrayRef<unsigned int> MaxPressureLimit)
- public void getMaxPressureDelta(const llvm::MachineInstr * MI, llvm::RegPressureDelta & Delta, ArrayRef<llvm::PressureChange> CriticalPSets, ArrayRef<unsigned int> MaxPressureLimit)
- public void getMaxUpwardPressureDelta(const llvm::MachineInstr * MI, llvm::PressureDiff * PDiff, llvm::RegPressureDelta & Delta, ArrayRef<llvm::PressureChange> CriticalPSets, ArrayRef<unsigned int> MaxPressureLimit)
- public MachineBasicBlock::const_iterator getPos() const
- public const llvm::RegisterPressure & getPressure() const
- public llvm::RegisterPressure & getPressure()
- public void getPressureAfterInst(const llvm::MachineInstr * MI, std::vector<unsigned int> & PressureResult, std::vector<unsigned int> & MaxPressureResult)
- public const std::vector<unsigned int> & getRegSetPressureAtPos() const
- public void getUpwardPressure(const llvm::MachineInstr * MI, std::vector<unsigned int> & PressureResult, std::vector<unsigned int> & MaxPressureResult)
- public void getUpwardPressureDelta(const llvm::MachineInstr * MI, llvm::PressureDiff & PDiff, llvm::RegPressureDelta & Delta, ArrayRef<llvm::PressureChange> CriticalPSets, ArrayRef<unsigned int> MaxPressureLimit) const
- public bool hasUntiedDef(unsigned int VirtReg) const
- protected void increaseRegPressure(unsigned int RegUnit, llvm::LaneBitmask PreviousMask, llvm::LaneBitmask NewMask)
- public void init(const llvm::MachineFunction * mf, const llvm::RegisterClassInfo * rci, const llvm::LiveIntervals * lis, const llvm::MachineBasicBlock * mbb, MachineBasicBlock::const_iterator pos, bool TrackLaneMasks, bool TrackUntiedDefs)
- public void initLiveThru(ArrayRef<unsigned int> PressureSet)
- public void initLiveThru(const llvm::RegPressureTracker & RPTracker)
- public bool isBottomClosed() const
- public bool isTopClosed() const
- public void recede(SmallVectorImpl<llvm::RegisterMaskPair> * LiveUses = nullptr)
- public void recede(const llvm::RegisterOperands & RegOpers, SmallVectorImpl<llvm::RegisterMaskPair> * LiveUses = nullptr)
- public void recedeSkipDebugValues()
- public void reset()
- public void setPos(MachineBasicBlock::const_iterator Pos)
Methods
¶RegPressureTracker(llvm::RegionPressure& rp)
RegPressureTracker(llvm::RegionPressure& rp)
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:399
Parameters
¶RegPressureTracker(llvm::IntervalPressure& rp)
RegPressureTracker(llvm::IntervalPressure& rp)
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:398
Parameters
¶void addLiveRegs(
ArrayRef<llvm::RegisterMaskPair> Regs)
void addLiveRegs(
ArrayRef<llvm::RegisterMaskPair> Regs)
Description
Force liveness of virtual registers or physical register units. Particularly useful to initialize the livein/out state of the tracker before the first call to advance/recede.
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:411
Parameters
- ArrayRef<llvm::RegisterMaskPair> Regs
¶void advance(
const llvm::RegisterOperands& RegOpers)
void advance(
const llvm::RegisterOperands& RegOpers)
Description
Advance across the current instruction. This is a "low-level" variant of advance() which takes precomputed RegisterOperands of the instruction.
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:441
Parameters
- const llvm::RegisterOperands& RegOpers
¶void advance()
void advance()
Description
Advance across the current instruction.
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:436
¶void bumpDeadDefs(
ArrayRef<llvm::RegisterMaskPair> DeadDefs)
void bumpDeadDefs(
ArrayRef<llvm::RegisterMaskPair> DeadDefs)
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:556
Parameters
- ArrayRef<llvm::RegisterMaskPair> DeadDefs
¶void bumpDownwardPressure(
const llvm::MachineInstr* MI)
void bumpDownwardPressure(
const llvm::MachineInstr* MI)
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:559
Parameters
- const llvm::MachineInstr* MI
¶void bumpUpwardPressure(
const llvm::MachineInstr* MI)
void bumpUpwardPressure(
const llvm::MachineInstr* MI)
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:558
Parameters
- const llvm::MachineInstr* MI
¶void closeBottom()
void closeBottom()
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:472
¶void closeRegion()
void closeRegion()
Description
Finalize the region boundaries and recored live ins and live outs.
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:444
¶void closeTop()
void closeTop()
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:471
¶void decreaseRegPressure(
unsigned int RegUnit,
llvm::LaneBitmask PreviousMask,
llvm::LaneBitmask NewMask)
void decreaseRegPressure(
unsigned int RegUnit,
llvm::LaneBitmask PreviousMask,
llvm::LaneBitmask NewMask)
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:553
Parameters
- unsigned int RegUnit
- llvm::LaneBitmask PreviousMask
- llvm::LaneBitmask NewMask
¶void discoverLiveIn(llvm::RegisterMaskPair Pair)
void discoverLiveIn(llvm::RegisterMaskPair Pair)
Description
Add Reg to the live in set and increase max pressure.
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:545
Parameters
¶void discoverLiveInOrOut(
llvm::RegisterMaskPair Pair,
SmallVectorImpl<llvm::RegisterMaskPair>&
LiveInOrOut)
void discoverLiveInOrOut(
llvm::RegisterMaskPair Pair,
SmallVectorImpl<llvm::RegisterMaskPair>&
LiveInOrOut)
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:561
Parameters
- llvm::RegisterMaskPair Pair
- SmallVectorImpl<llvm::RegisterMaskPair>& LiveInOrOut
¶void discoverLiveOut(llvm::RegisterMaskPair Pair)
void discoverLiveOut(llvm::RegisterMaskPair Pair)
Description
Add Reg to the live out set and increase max pressure.
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:543
Parameters
¶void dump() const
void dump() const
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:539
¶llvm::SlotIndex getCurrSlot() const
llvm::SlotIndex getCurrSlot() const
Description
Get the SlotIndex for the first nondebug instruction including or after the current position.
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:549
¶void getDownwardPressure(
const llvm::MachineInstr* MI,
std::vector<unsigned int>& PressureResult,
std::vector<unsigned int>& MaxPressureResult)
void getDownwardPressure(
const llvm::MachineInstr* MI,
std::vector<unsigned int>& PressureResult,
std::vector<unsigned int>& MaxPressureResult)
Description
Get the pressure of each PSet after traversing this instruction top-down.
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:521
Parameters
- const llvm::MachineInstr* MI
- std::vector<unsigned int>& PressureResult
- std::vector<unsigned int>& MaxPressureResult
¶llvm::LaneBitmask getLastUsedLanes(
unsigned int RegUnit,
llvm::SlotIndex Pos) const
llvm::LaneBitmask getLastUsedLanes(
unsigned int RegUnit,
llvm::SlotIndex Pos) const
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:564
Parameters
- unsigned int RegUnit
- llvm::SlotIndex Pos
¶llvm::LaneBitmask getLiveLanesAt(
unsigned int RegUnit,
llvm::SlotIndex Pos) const
llvm::LaneBitmask getLiveLanesAt(
unsigned int RegUnit,
llvm::SlotIndex Pos) const
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:565
Parameters
- unsigned int RegUnit
- llvm::SlotIndex Pos
¶llvm::LaneBitmask getLiveThroughAt(
unsigned int RegUnit,
llvm::SlotIndex Pos) const
llvm::LaneBitmask getLiveThroughAt(
unsigned int RegUnit,
llvm::SlotIndex Pos) const
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:566
Parameters
- unsigned int RegUnit
- llvm::SlotIndex Pos
¶ArrayRef<unsigned int> getLiveThru() const
ArrayRef<unsigned int> getLiveThru() const
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:455
¶void getMaxDownwardPressureDelta(
const llvm::MachineInstr* MI,
llvm::RegPressureDelta& Delta,
ArrayRef<llvm::PressureChange> CriticalPSets,
ArrayRef<unsigned int> MaxPressureLimit)
void getMaxDownwardPressureDelta(
const llvm::MachineInstr* MI,
llvm::RegPressureDelta& Delta,
ArrayRef<llvm::PressureChange> CriticalPSets,
ArrayRef<unsigned int> MaxPressureLimit)
Description
Consider the pressure increase caused by traversing this instruction top-down. Find the pressure set with the most change beyond its pressure limit based on the tracker's current pressure, and record the number of excess register units of that pressure set introduced by this instruction.
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:494
Parameters
- const llvm::MachineInstr* MI
- llvm::RegPressureDelta& Delta
- ArrayRef<llvm::PressureChange> CriticalPSets
- ArrayRef<unsigned int> MaxPressureLimit
¶void getMaxPressureDelta(
const llvm::MachineInstr* MI,
llvm::RegPressureDelta& Delta,
ArrayRef<llvm::PressureChange> CriticalPSets,
ArrayRef<unsigned int> MaxPressureLimit)
void getMaxPressureDelta(
const llvm::MachineInstr* MI,
llvm::RegPressureDelta& Delta,
ArrayRef<llvm::PressureChange> CriticalPSets,
ArrayRef<unsigned int> MaxPressureLimit)
Description
Find the pressure set with the most change beyond its pressure limit after traversing this instruction either upward or downward depending on the closed end of the current region.
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:502
Parameters
- const llvm::MachineInstr* MI
- llvm::RegPressureDelta& Delta
- ArrayRef<llvm::PressureChange> CriticalPSets
- ArrayRef<unsigned int> MaxPressureLimit
¶void getMaxUpwardPressureDelta(
const llvm::MachineInstr* MI,
llvm::PressureDiff* PDiff,
llvm::RegPressureDelta& Delta,
ArrayRef<llvm::PressureChange> CriticalPSets,
ArrayRef<unsigned int> MaxPressureLimit)
void getMaxUpwardPressureDelta(
const llvm::MachineInstr* MI,
llvm::PressureDiff* PDiff,
llvm::RegPressureDelta& Delta,
ArrayRef<llvm::PressureChange> CriticalPSets,
ArrayRef<unsigned int> MaxPressureLimit)
Description
Consider the pressure increase caused by traversing this instruction bottom-up. Find the pressure set with the most change beyond its pressure limit based on the tracker's current pressure, and record the number of excess register units of that pressure set introduced by this instruction.
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:478
Parameters
- const llvm::MachineInstr* MI
- llvm::PressureDiff* PDiff
- llvm::RegPressureDelta& Delta
- ArrayRef<llvm::PressureChange> CriticalPSets
- ArrayRef<unsigned int> MaxPressureLimit
¶MachineBasicBlock::const_iterator getPos() const
MachineBasicBlock::const_iterator getPos() const
Description
Get the MI position corresponding to this register pressure.
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:414
¶const llvm::RegisterPressure& getPressure() const
const llvm::RegisterPressure& getPressure() const
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:460
¶llvm::RegisterPressure& getPressure()
llvm::RegisterPressure& getPressure()
Description
Get the resulting register pressure over the traversed region. This result is complete if closeRegion() was explicitly invoked.
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:459
¶void getPressureAfterInst(
const llvm::MachineInstr* MI,
std::vector<unsigned int>& PressureResult,
std::vector<unsigned int>& MaxPressureResult)
void getPressureAfterInst(
const llvm::MachineInstr* MI,
std::vector<unsigned int>& PressureResult,
std::vector<unsigned int>& MaxPressureResult)
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:525
Parameters
- const llvm::MachineInstr* MI
- std::vector<unsigned int>& PressureResult
- std::vector<unsigned int>& MaxPressureResult
¶const std::vector<unsigned int>&
getRegSetPressureAtPos() const
const std::vector<unsigned int>&
getRegSetPressureAtPos() const
Description
Get the register set pressure at the current position, which may be less than the pressure across the traversed region.
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:464
¶void getUpwardPressure(
const llvm::MachineInstr* MI,
std::vector<unsigned int>& PressureResult,
std::vector<unsigned int>& MaxPressureResult)
void getUpwardPressure(
const llvm::MachineInstr* MI,
std::vector<unsigned int>& PressureResult,
std::vector<unsigned int>& MaxPressureResult)
Description
Get the pressure of each PSet after traversing this instruction bottom-up.
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:516
Parameters
- const llvm::MachineInstr* MI
- std::vector<unsigned int>& PressureResult
- std::vector<unsigned int>& MaxPressureResult
¶void getUpwardPressureDelta(
const llvm::MachineInstr* MI,
llvm::PressureDiff& PDiff,
llvm::RegPressureDelta& Delta,
ArrayRef<llvm::PressureChange> CriticalPSets,
ArrayRef<unsigned int> MaxPressureLimit) const
void getUpwardPressureDelta(
const llvm::MachineInstr* MI,
llvm::PressureDiff& PDiff,
llvm::RegPressureDelta& Delta,
ArrayRef<llvm::PressureChange> CriticalPSets,
ArrayRef<unsigned int> MaxPressureLimit) const
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:484
Parameters
- const llvm::MachineInstr* MI
- llvm::PressureDiff& PDiff
- llvm::RegPressureDelta& Delta
- ArrayRef<llvm::PressureChange> CriticalPSets
- ArrayRef<unsigned int> MaxPressureLimit
¶bool hasUntiedDef(unsigned int VirtReg) const
bool hasUntiedDef(unsigned int VirtReg) const
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:535
Parameters
- unsigned int VirtReg
¶void increaseRegPressure(
unsigned int RegUnit,
llvm::LaneBitmask PreviousMask,
llvm::LaneBitmask NewMask)
void increaseRegPressure(
unsigned int RegUnit,
llvm::LaneBitmask PreviousMask,
llvm::LaneBitmask NewMask)
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:551
Parameters
- unsigned int RegUnit
- llvm::LaneBitmask PreviousMask
- llvm::LaneBitmask NewMask
¶void init(const llvm::MachineFunction* mf,
const llvm::RegisterClassInfo* rci,
const llvm::LiveIntervals* lis,
const llvm::MachineBasicBlock* mbb,
MachineBasicBlock::const_iterator pos,
bool TrackLaneMasks,
bool TrackUntiedDefs)
void init(const llvm::MachineFunction* mf,
const llvm::RegisterClassInfo* rci,
const llvm::LiveIntervals* lis,
const llvm::MachineBasicBlock* mbb,
MachineBasicBlock::const_iterator pos,
bool TrackLaneMasks,
bool TrackUntiedDefs)
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:403
Parameters
- const llvm::MachineFunction* mf
- const llvm::RegisterClassInfo* rci
- const llvm::LiveIntervals* lis
- const llvm::MachineBasicBlock* mbb
- MachineBasicBlock::const_iterator pos
- bool TrackLaneMasks
- bool TrackUntiedDefs
¶void initLiveThru(
ArrayRef<unsigned int> PressureSet)
void initLiveThru(
ArrayRef<unsigned int> PressureSet)
Description
Copy an existing live thru pressure result.
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:451
Parameters
- ArrayRef<unsigned int> PressureSet
¶void initLiveThru(
const llvm::RegPressureTracker& RPTracker)
void initLiveThru(
const llvm::RegPressureTracker& RPTracker)
Description
Initialize the LiveThru pressure set based on the untied defs found in RPTracker.
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:448
Parameters
- const llvm::RegPressureTracker& RPTracker
¶bool isBottomClosed() const
bool isBottomClosed() const
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:469
¶bool isTopClosed() const
bool isTopClosed() const
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:468
¶void recede(
SmallVectorImpl<llvm::RegisterMaskPair>*
LiveUses = nullptr)
void recede(
SmallVectorImpl<llvm::RegisterMaskPair>*
LiveUses = nullptr)
Description
Recede across the previous instruction.
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:423
Parameters
- SmallVectorImpl<llvm::RegisterMaskPair>* LiveUses = nullptr
¶void recede(
const llvm::RegisterOperands& RegOpers,
SmallVectorImpl<llvm::RegisterMaskPair>*
LiveUses = nullptr)
void recede(
const llvm::RegisterOperands& RegOpers,
SmallVectorImpl<llvm::RegisterMaskPair>*
LiveUses = nullptr)
Description
Recede across the previous instruction. This "low-level" variant assumes that recedeSkipDebugValues() was called previously and takes precomputed RegisterOperands for the instruction.
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:429
Parameters
- const llvm::RegisterOperands& RegOpers
- SmallVectorImpl<llvm::RegisterMaskPair>* LiveUses = nullptr
¶void recedeSkipDebugValues()
void recedeSkipDebugValues()
Description
Recede until we find an instruction which is not a DebugValue.
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:433
¶void reset()
void reset()
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:401
¶void setPos(MachineBasicBlock::const_iterator Pos)
void setPos(MachineBasicBlock::const_iterator Pos)
Declared at: llvm/include/llvm/CodeGen/RegisterPressure.h:420