LLVM 24.0.0git
llvm::GCNRPTarget Class Reference

Models a register pressure target, allowing to evaluate and track register savings against that target from a starting GCNRegPressure. More...

#include "Target/AMDGPU/GCNRegPressure.h"

Public Member Functions

 GCNRPTarget (const MachineFunction &MF, const GCNRegPressure &RP)
 Sets up the target such that the register pressure starting at RP does not show register spilling on function MF (w.r.t.
 GCNRPTarget (unsigned NumSGPRs, unsigned NumVGPRs, const MachineFunction &MF, const GCNRegPressure &RP)
 Sets up the target such that the register pressure starting at RP does not use more than NumSGPRs SGPRs and NumVGPRs VGPRs on function MF.
 GCNRPTarget (unsigned Occupancy, const MachineFunction &MF, const GCNRegPressure &RP)
 Sets up the target such that the register pressure starting at RP does not prevent achieving an occupancy of at least Occupancy on function MF.
void setTarget (unsigned NumSGPRs, unsigned NumVGPRs)
 Changes the target (same semantics as constructor).
const GCNRegPressure & getCurrentRP () const
void setRP (const GCNRegPressure &NewRP)
bool isSaveBeneficial (Register Reg) const
 Determines whether saving virtual register Reg will be beneficial towards achieving the RP target.
bool isSaveBeneficial (const GCNRegPressure &SaveRP) const
 Returns whether the benefit that saving SaveRP represents will be beneficial towards achieving the RP target.
unsigned getNumRegsBenefit (const GCNRegPressure &SaveRP) const
 Returns the benefit towards achieving the RP target that saving SaveRP represents, in total number of registers saved across all classes.
void saveRP (const GCNRegPressure &SaveRP)
 Saves a total pressure of SaveRP.
bool satisfied (const GCNRegPressure &TestRP) const
 Whether TestRP is at or below the defined pressure target.
bool satisfied () const
 Whether the current RP is at or below the defined pressure target.
bool hasVectorRegisterExcess () const
unsigned getMaxSGPRs () const
unsigned getMaxVGPRs () const

Friends

raw_ostream & operator<< (raw_ostream &OS, const GCNRPTarget &Target)

Detailed Description

Models a register pressure target, allowing to evaluate and track register savings against that target from a starting GCNRegPressure.

Definition at line 266 of file GCNRegPressure.h.

Constructor & Destructor Documentation

◆ GCNRPTarget() [1/3]

GCNRPTarget::GCNRPTarget ( const MachineFunction & MF,
const GCNRegPressure & RP )

Sets up the target such that the register pressure starting at RP does not show register spilling on function MF (w.r.t.

the function's mininum target occupancy).

Definition at line 378 of file GCNRegPressure.cpp.

References F, GCNRPTarget(), and setTarget().

Referenced by GCNRPTarget(), GCNRPTarget(), and operator<<.

◆ GCNRPTarget() [2/3]

GCNRPTarget::GCNRPTarget ( unsigned NumSGPRs,
unsigned NumVGPRs,
const MachineFunction & MF,
const GCNRegPressure & RP )

Sets up the target such that the register pressure starting at RP does not use more than NumSGPRs SGPRs and NumVGPRs VGPRs on function MF.

Definition at line 385 of file GCNRegPressure.cpp.

◆ GCNRPTarget() [3/3]

GCNRPTarget::GCNRPTarget ( unsigned Occupancy,
const MachineFunction & MF,
const GCNRegPressure & RP )

Sets up the target such that the register pressure starting at RP does not prevent achieving an occupancy of at least Occupancy on function MF.

Definition at line 391 of file GCNRegPressure.cpp.

References GCNRPTarget().

Member Function Documentation

◆ getCurrentRP()

const GCNRegPressure & llvm::GCNRPTarget::getCurrentRP ( ) const
inline

Definition at line 288 of file GCNRegPressure.h.

◆ getMaxSGPRs()

unsigned llvm::GCNRPTarget::getMaxSGPRs ( ) const
inline

Definition at line 316 of file GCNRegPressure.h.

◆ getMaxVGPRs()

unsigned llvm::GCNRPTarget::getMaxVGPRs ( ) const
inline

Definition at line 317 of file GCNRegPressure.h.

◆ getNumRegsBenefit()

unsigned GCNRPTarget::getNumRegsBenefit ( const GCNRegPressure & SaveRP) const

Returns the benefit towards achieving the RP target that saving SaveRP represents, in total number of registers saved across all classes.

Definition at line 445 of file GCNRegPressure.cpp.

References llvm::GCNRegPressure::getAGPRNum(), llvm::GCNRegPressure::getArchVGPRNum(), and llvm::GCNRegPressure::getSGPRNum().

◆ hasVectorRegisterExcess()

bool GCNRPTarget::hasVectorRegisterExcess ( ) const

Definition at line 477 of file GCNRegPressure.cpp.

◆ isSaveBeneficial() [1/2]

bool GCNRPTarget::isSaveBeneficial ( const GCNRegPressure & SaveRP) const

Returns whether the benefit that saving SaveRP represents will be beneficial towards achieving the RP target.

Definition at line 432 of file GCNRegPressure.cpp.

References llvm::GCNRegPressure::getAGPRNum(), llvm::GCNRegPressure::getArchVGPRNum(), and llvm::GCNRegPressure::getSGPRNum().

◆ isSaveBeneficial() [2/2]

bool GCNRPTarget::isSaveBeneficial ( Register Reg) const

Determines whether saving virtual register Reg will be beneficial towards achieving the RP target.

Definition at line 415 of file GCNRegPressure.cpp.

References llvm::SIRegisterInfo::isAGPRClass(), llvm::SIRegisterInfo::isSGPRClass(), MRI, and TRI.

◆ satisfied() [1/2]

bool llvm::GCNRPTarget::satisfied ( ) const
inline

Whether the current RP is at or below the defined pressure target.

Definition at line 313 of file GCNRegPressure.h.

References satisfied().

Referenced by satisfied().

◆ satisfied() [2/2]

bool GCNRPTarget::satisfied ( const GCNRegPressure & TestRP) const

Whether TestRP is at or below the defined pressure target.

Definition at line 469 of file GCNRegPressure.cpp.

References llvm::GCNRegPressure::getSGPRNum(), and llvm::GCNRegPressure::getVGPRNum().

◆ saveRP()

void llvm::GCNRPTarget::saveRP ( const GCNRegPressure & SaveRP)
inline

Saves a total pressure of SaveRP.

Definition at line 305 of file GCNRegPressure.h.

References assert().

◆ setRP()

void llvm::GCNRPTarget::setRP ( const GCNRegPressure & NewRP)
inline

Definition at line 290 of file GCNRegPressure.h.

◆ setTarget()

void GCNRPTarget::setTarget ( unsigned NumSGPRs,
unsigned NumVGPRs )

Changes the target (same semantics as constructor).

Definition at line 401 of file GCNRegPressure.cpp.

Referenced by GCNRPTarget().

◆ operator<<

raw_ostream & operator<< ( raw_ostream & OS,
const GCNRPTarget & Target )
friend

Definition at line 322 of file GCNRegPressure.h.

References GCNRPTarget().


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