17 #ifndef LLVM_LIB_TARGET_AMDGPU_GCNREGPRESSURE_H 18 #define LLVM_LIB_TARGET_AMDGPU_GCNREGPRESSURE_H 26 class MachineRegisterInfo;
191 const LiveIntervals &LIS,
192 const MachineRegisterInfo &
MRI);
195 const LiveIntervals &LIS,
196 const MachineRegisterInfo &
MRI);
203 template <
typename Range>
204 DenseMap<MachineInstr*, GCNRPTracker::LiveRegSet>
206 std::vector<SlotIndex> Indexes;
207 Indexes.reserve(std::distance(R.begin(), R.end()));
210 auto SI = SII.getInstructionIndex(*
I);
211 Indexes.push_back(After ?
SI.getDeadSlot() :
SI.getBaseIndex());
218 for (
unsigned I = 0,
E =
MRI.getNumVirtRegs();
I !=
E; ++
I) {
224 if (!LI.findIndexesLiveAt(Indexes, std::back_inserter(LiveIdxs)))
226 if (!LI.hasSubRanges()) {
227 for (
auto SI : LiveIdxs)
228 LiveRegMap[SII.getInstructionFromIndex(
SI)][
Reg] =
229 MRI.getMaxLaneMaskForVReg(
Reg);
231 for (
const auto &S : LI.subranges()) {
234 S.findIndexesLiveAt(LiveIdxs, std::back_inserter(SRLiveIdxs));
235 for (
auto SI : SRLiveIdxs)
236 LiveRegMap[SII.getInstructionFromIndex(
SI)][
Reg] |= S.LaneMask;
245 MI.getParent()->getParent()->getRegInfo());
251 MI.getParent()->getParent()->getRegInfo());
254 template <
typename Range>
258 for (
const auto &
RM : LiveRegs)
267 const LiveIntervals &LIS,
268 const MachineRegisterInfo &
MRI);
272 #endif // LLVM_LIB_TARGET_AMDGPU_GCNREGPRESSURE_H
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
AMDGPU specific subclass of TargetSubtarget.
SlotIndex getBaseIndex() const
Returns the base index for associated with this index.
static void printLiveRegs(raw_ostream &OS, const LiveRegSet &LiveRegs, const MachineRegisterInfo &MRI)
This class represents lattice values for constants.
decltype(MaxPressure) moveMaxPressure()
unsigned getSGPRTuplesWeight() const
GCNRPTracker(const LiveIntervals &LIS_)
const MachineInstr * LastTrackedMI
bool reset(const MachineInstr &MI, const LiveRegSet *LiveRegs=nullptr)
GCNRPTracker::LiveRegSet getLiveRegs(SlotIndex SI, const LiveIntervals &LIS, const MachineRegisterInfo &MRI)
friend GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
const LiveIntervals & LIS
decltype(LiveRegs) moveLiveRegs()
bool operator!=(const GCNRegPressure &O) const
decltype(LiveRegs) const & getLiveRegs() const
SlotIndex getDeadSlot() const
Returns the dead def kill slot for the current instruction.
unsigned getOccupancy(const GCNSubtarget &ST) const
static constexpr LaneBitmask getNone()
bool hasInterval(Register Reg) const
void inc(unsigned Reg, LaneBitmask PrevMask, LaneBitmask NewMask, const MachineRegisterInfo &MRI)
unsigned getVGPRTuplesWeight() const
GCNRPTracker::LiveRegSet getLiveRegsBefore(const MachineInstr &MI, const LiveIntervals &LIS)
const MachineBasicBlock::const_iterator getNext() const
bool less(const GCNSubtarget &ST, const GCNRegPressure &O, unsigned MaxOccupancy=std::numeric_limits< unsigned >::max()) const
GCNRegPressure CurPressure
void reset(const MachineInstr &MI, const LiveRegSet *LiveRegs=nullptr)
unsigned const MachineRegisterInfo * MRI
const MachineInstr * getLastTrackedMI() const
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
unsigned getSGPRNum() const
static Register index2VirtReg(unsigned Index)
Convert a 0-based index to a virtual register number.
DenseMap< MachineInstr *, GCNRPTracker::LiveRegSet > getLiveRegMap(Range &&R, bool After, LiveIntervals &LIS)
creates a map MachineInstr -> LiveRegSet R - range of iterators on instructions After - upon entry or...
Expected< ExpressionValue > min(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
LiveInterval & getInterval(Register Reg)
void sort(IteratorTy Start, IteratorTy End)
A set of live virtual registers and physical register units.
GCNRPTracker::LiveRegSet getLiveRegsAfter(const MachineInstr &MI, const LiveIntervals &LIS)
GCNUpwardRPTracker(const LiveIntervals &LIS_)
void printLivesAt(SlotIndex SI, const LiveIntervals &LIS, const MachineRegisterInfo &MRI)
Align max(MaybeAlign Lhs, Align Rhs)
unsigned getVGPRNum() const
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
DenseMap< unsigned, LaneBitmask > LiveRegSet
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
bool higherOccupancy(const GCNSubtarget &ST, const GCNRegPressure &O) const
SlotIndex getInstructionIndex(const MachineInstr &Instr) const
Returns the base index of the given instruction.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
GCNRegPressure getRegPressure(const MachineRegisterInfo &MRI, Range &&LiveRegs)
Representation of each machine instruction.
SlotIndexes * getSlotIndexes() const
LaneBitmask getLiveLaneMask(unsigned Reg, SlotIndex SI, const LiveIntervals &LIS, const MachineRegisterInfo &MRI)
bool operator==(const GCNRegPressure &O) const
void print(raw_ostream &OS, const GCNSubtarget *ST=nullptr) const
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
static const Function * getParent(const Value *V)
This class implements an extremely fast bulk output stream that can only output to a stream.
bool isEqual(const GCNRPTracker::LiveRegSet &S1, const GCNRPTracker::LiveRegSet &S2)
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
GCNRegPressure MaxPressure
GCNDownwardRPTracker(const LiveIntervals &LIS_)
void recede(const MachineInstr &MI)
void reset(const MachineInstr &MI, const LiveRegSet *LiveRegsCopy, bool After)
Wrapper class representing virtual and physical registers.
const MachineRegisterInfo * MRI