LLVM 22.0.0git
llvm::GCNRegPressure Struct Reference

#include "Target/AMDGPU/GCNRegPressure.h"

Public Types

enum  RegKind {
  SGPR , VGPR , AGPR , AVGPR ,
  TOTAL_KINDS
}

Public Member Functions

 GCNRegPressure ()
bool empty () const
void clear ()
unsigned getSGPRNum () const
unsigned getVGPRNum (bool UnifiedVGPRFile) const
unsigned getArchVGPRNum () const
unsigned getAGPRNum () const
unsigned getAVGPRNum () const
unsigned getVGPRTuplesWeight () const
unsigned getSGPRTuplesWeight () const
unsigned getOccupancy (const GCNSubtarget &ST, unsigned DynamicVGPRBlockSize) const
void inc (unsigned Reg, LaneBitmask PrevMask, LaneBitmask NewMask, const MachineRegisterInfo &MRI)
bool higherOccupancy (const GCNSubtarget &ST, const GCNRegPressure &O, unsigned DynamicVGPRBlockSize) 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.
bool operator== (const GCNRegPressure &O) const
bool operator!= (const GCNRegPressure &O) const
GCNRegPressureoperator+= (const GCNRegPressure &RHS)
GCNRegPressureoperator-= (const GCNRegPressure &RHS)
void dump () const

Static Public Member Functions

static unsigned getUnifiedVGPRNum (unsigned NumArchVGPRs, unsigned NumAGPRs, unsigned NumAVGPRs)
 Returns the aggregated VGPR pressure, assuming NumArchVGPRs ArchVGPRs NumAGPRs AGPRS, and NumAVGPRs AVGPRs for a target with a unified VGPR file.

Friends

GCNRegPressure max (const GCNRegPressure &P1, const GCNRegPressure &P2)
Printable print (const GCNRegPressure &RP, const GCNSubtarget *ST=nullptr, unsigned DynamicVGPRBlockSize=0)

Detailed Description

Definition at line 31 of file GCNRegPressure.h.

Member Enumeration Documentation

◆ RegKind

Enumerator
SGPR 
VGPR 
AGPR 
AVGPR 
TOTAL_KINDS 

Definition at line 32 of file GCNRegPressure.h.

Constructor & Destructor Documentation

◆ GCNRegPressure()

llvm::GCNRegPressure::GCNRegPressure ( )
inline

Definition at line 34 of file GCNRegPressure.h.

References clear().

Referenced by higherOccupancy(), less(), max, operator!=(), operator+=(), operator-=(), operator==(), and print.

Member Function Documentation

◆ clear()

void llvm::GCNRegPressure::clear ( )
inline

Definition at line 42 of file GCNRegPressure.h.

Referenced by GCNRegPressure().

◆ dump()

void GCNRegPressure::dump ( ) const

Definition at line 829 of file GCNRegPressure.cpp.

References llvm::dbgs(), and print.

◆ empty()

bool llvm::GCNRegPressure::empty ( ) const
inline

Definition at line 38 of file GCNRegPressure.h.

References AGPR, AVGPR, SGPR, and VGPR.

Referenced by llvm::GCNIterativeScheduler::scheduleRegion().

◆ getAGPRNum()

unsigned llvm::GCNRegPressure::getAGPRNum ( ) const
inline
Returns
the AccVGPR32 pressure

Definition at line 76 of file GCNRegPressure.h.

References AGPR.

Referenced by getRegisterPressures(), and less().

◆ getArchVGPRNum()

unsigned llvm::GCNRegPressure::getArchVGPRNum ( ) const
inline
Returns
the ArchVGPR32 pressure, plus the AVGPRS which we assume will be allocated as VGPR

Definition at line 74 of file GCNRegPressure.h.

References AVGPR, and VGPR.

Referenced by getRegisterPressures().

◆ getAVGPRNum()

unsigned llvm::GCNRegPressure::getAVGPRNum ( ) const
inline
Returns
the AVGPR32 pressure

Definition at line 78 of file GCNRegPressure.h.

References AVGPR.

◆ getOccupancy()

unsigned llvm::GCNRegPressure::getOccupancy ( const GCNSubtarget & ST,
unsigned DynamicVGPRBlockSize ) const
inline

Definition at line 86 of file GCNRegPressure.h.

References getSGPRNum(), and getVGPRNum().

Referenced by higherOccupancy().

◆ getSGPRNum()

unsigned llvm::GCNRegPressure::getSGPRNum ( ) const
inline
Returns
the SGPR32 pressure

Definition at line 45 of file GCNRegPressure.h.

References SGPR.

Referenced by getOccupancy(), getRegisterPressures(), and less().

◆ getSGPRTuplesWeight()

unsigned llvm::GCNRegPressure::getSGPRTuplesWeight ( ) const
inline

Definition at line 84 of file GCNRegPressure.h.

References SGPR, and TOTAL_KINDS.

Referenced by less().

◆ getUnifiedVGPRNum()

unsigned llvm::GCNRegPressure::getUnifiedVGPRNum ( unsigned NumArchVGPRs,
unsigned NumAGPRs,
unsigned NumAVGPRs )
inlinestatic

Returns the aggregated VGPR pressure, assuming NumArchVGPRs ArchVGPRs NumAGPRs AGPRS, and NumAVGPRs AVGPRs for a target with a unified VGPR file.

Definition at line 62 of file GCNRegPressure.h.

References llvm::alignTo(), and llvm::AMDGPU::IsaInfo::getArchVGPRAllocGranule().

Referenced by getVGPRNum().

◆ getVGPRNum()

unsigned llvm::GCNRegPressure::getVGPRNum ( bool UnifiedVGPRFile) const
inline
Returns
the aggregated ArchVGPR32, AccVGPR32, and Pseudo AVGPR pressure dependent upon UnifiedVGPRFile

Definition at line 48 of file GCNRegPressure.h.

References AGPR, AVGPR, getUnifiedVGPRNum(), and VGPR.

Referenced by getOccupancy(), and less().

◆ getVGPRTuplesWeight()

unsigned llvm::GCNRegPressure::getVGPRTuplesWeight ( ) const
inline

Definition at line 80 of file GCNRegPressure.h.

References AGPR, AVGPR, TOTAL_KINDS, and VGPR.

Referenced by less().

◆ higherOccupancy()

bool llvm::GCNRegPressure::higherOccupancy ( const GCNSubtarget & ST,
const GCNRegPressure & O,
unsigned DynamicVGPRBlockSize ) const
inline

Definition at line 98 of file GCNRegPressure.h.

References GCNRegPressure(), and getOccupancy().

◆ inc()

◆ less()

bool GCNRegPressure::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.

Since GCNRegpressure contains different types of pressures, and due to target-specific pecularities (e.g. we care about occupancy rather than raw register usage), we determine if this GCNRegPressure is less than O based on the following tiered comparisons (in order order of precedence):

  1. Better occupancy
  2. Less spilling (first preference to VGPR spills, then to SGPR spills)
  3. Less tuple register pressure (first preference to VGPR tuples if we determine that SGPR pressure is not important)
  4. Less raw register pressure (first preference to VGPR tuples if we determine that SGPR pressure is not important)

Definition at line 99 of file GCNRegPressure.cpp.

References GCNRegPressure(), getAGPRNum(), llvm::MachineFunction::getInfo(), getSGPRNum(), getSGPRTuplesWeight(), llvm::MachineFunction::getSubtarget(), getVGPRNum(), getVGPRTuplesWeight(), and I.

◆ operator!=()

bool llvm::GCNRegPressure::operator!= ( const GCNRegPressure & O) const
inline

Definition at line 123 of file GCNRegPressure.h.

References GCNRegPressure().

◆ operator+=()

GCNRegPressure & llvm::GCNRegPressure::operator+= ( const GCNRegPressure & RHS)
inline

Definition at line 127 of file GCNRegPressure.h.

References GCNRegPressure(), I, and RHS.

◆ operator-=()

GCNRegPressure & llvm::GCNRegPressure::operator-= ( const GCNRegPressure & RHS)
inline

Definition at line 133 of file GCNRegPressure.h.

References GCNRegPressure(), I, and RHS.

◆ operator==()

bool llvm::GCNRegPressure::operator== ( const GCNRegPressure & O) const
inline

Definition at line 119 of file GCNRegPressure.h.

References GCNRegPressure().

◆ max

Definition at line 158 of file GCNRegPressure.h.

References GCNRegPressure(), and I.

◆ print

Printable print ( const GCNRegPressure & RP,
const GCNSubtarget * ST = nullptr,
unsigned DynamicVGPRBlockSize = 0 )
friend

References GCNRegPressure().

Referenced by dump().


The documentation for this struct was generated from the following files: