LLVM 20.0.0git
Public Types | Public Member Functions | List of all members
llvm::MCResourceInfo Class Reference

#include "Target/AMDGPU/AMDGPUMCResourceInfo.h"

Public Types

enum  ResourceInfoKind {
  RIK_NumVGPR , RIK_NumAGPR , RIK_NumSGPR , RIK_PrivateSegSize ,
  RIK_UsesVCC , RIK_UsesFlatScratch , RIK_HasDynSizedStack , RIK_HasRecursion ,
  RIK_HasIndirectCall
}
 

Public Member Functions

 MCResourceInfo ()=default
 
void addMaxVGPRCandidate (int32_t candidate)
 
void addMaxAGPRCandidate (int32_t candidate)
 
void addMaxSGPRCandidate (int32_t candidate)
 
MCSymbolgetSymbol (StringRef FuncName, ResourceInfoKind RIK, MCContext &OutContext)
 
const MCExprgetSymRefExpr (StringRef FuncName, ResourceInfoKind RIK, MCContext &Ctx)
 
void reset ()
 
void finalize (MCContext &OutContext)
 
MCSymbolgetMaxVGPRSymbol (MCContext &OutContext)
 
MCSymbolgetMaxAGPRSymbol (MCContext &OutContext)
 
MCSymbolgetMaxSGPRSymbol (MCContext &OutContext)
 
void gatherResourceInfo (const MachineFunction &MF, const AMDGPUResourceUsageAnalysis::SIFunctionResourceInfo &FRI, MCContext &OutContext)
 AMDGPUResourceUsageAnalysis gathers resource usage on a per-function granularity.
 
const MCExprcreateTotalNumVGPRs (const MachineFunction &MF, MCContext &Ctx)
 
const MCExprcreateTotalNumSGPRs (const MachineFunction &MF, bool hasXnack, MCContext &Ctx)
 

Detailed Description

Definition at line 28 of file AMDGPUMCResourceInfo.h.

Member Enumeration Documentation

◆ ResourceInfoKind

Enumerator
RIK_NumVGPR 
RIK_NumAGPR 
RIK_NumSGPR 
RIK_PrivateSegSize 
RIK_UsesVCC 
RIK_UsesFlatScratch 
RIK_HasDynSizedStack 
RIK_HasRecursion 
RIK_HasIndirectCall 

Definition at line 30 of file AMDGPUMCResourceInfo.h.

Constructor & Destructor Documentation

◆ MCResourceInfo()

llvm::MCResourceInfo::MCResourceInfo ( )
default

Referenced by reset().

Member Function Documentation

◆ addMaxAGPRCandidate()

void llvm::MCResourceInfo::addMaxAGPRCandidate ( int32_t  candidate)
inline

Definition at line 66 of file AMDGPUMCResourceInfo.h.

Referenced by gatherResourceInfo().

◆ addMaxSGPRCandidate()

void llvm::MCResourceInfo::addMaxSGPRCandidate ( int32_t  candidate)
inline

Definition at line 69 of file AMDGPUMCResourceInfo.h.

Referenced by gatherResourceInfo().

◆ addMaxVGPRCandidate()

void llvm::MCResourceInfo::addMaxVGPRCandidate ( int32_t  candidate)
inline

Definition at line 63 of file AMDGPUMCResourceInfo.h.

Referenced by gatherResourceInfo().

◆ createTotalNumSGPRs()

const MCExpr * MCResourceInfo::createTotalNumSGPRs ( const MachineFunction MF,
bool  hasXnack,
MCContext Ctx 
)

◆ createTotalNumVGPRs()

const MCExpr * MCResourceInfo::createTotalNumVGPRs ( const MachineFunction MF,
MCContext Ctx 
)

◆ finalize()

void MCResourceInfo::finalize ( MCContext OutContext)

Definition at line 76 of file AMDGPUMCResourceInfo.cpp.

References assert().

Referenced by llvm::AMDGPUAsmPrinter::doFinalization().

◆ gatherResourceInfo()

void MCResourceInfo::gatherResourceInfo ( const MachineFunction MF,
const AMDGPUResourceUsageAnalysis::SIFunctionResourceInfo FRI,
MCContext OutContext 
)

AMDGPUResourceUsageAnalysis gathers resource usage on a per-function granularity.

However, some resource info has to be assigned the call transitive maximum or accumulative. For example, if A calls B and B's VGPR usage exceeds A's, A should be assigned B's VGPR usage. Furthermore, functions with indirect calls should be assigned the module level maximum.

Definition at line 150 of file AMDGPUMCResourceInfo.cpp.

References addMaxAGPRCandidate(), addMaxSGPRCandidate(), addMaxVGPRCandidate(), llvm::AMDGPUMCExpr::AGVK_Max, llvm::AMDGPUMCExpr::AGVK_Or, llvm::AMDGPUResourceUsageAnalysis::SIFunctionResourceInfo::Callees, llvm::AMDGPUResourceUsageAnalysis::SIFunctionResourceInfo::CalleeSegmentSize, llvm::MCSymbolRefExpr::create(), llvm::MCConstantExpr::create(), llvm::MCBinaryExpr::createAdd(), llvm::AMDGPUMCExpr::createMax(), llvm::SmallVectorBase< Size_T >::empty(), llvm::Function::getCallingConv(), llvm::MachineFunction::getFunction(), getMaxAGPRSymbol(), getMaxSGPRSymbol(), getMaxVGPRSymbol(), llvm::MCSymbol::getName(), getSymbol(), llvm::MachineFunction::getTarget(), llvm::MCSymbol::getVariableValue(), llvm::AMDGPUResourceUsageAnalysis::SIFunctionResourceInfo::HasDynamicallySizedStack, llvm::AMDGPUResourceUsageAnalysis::SIFunctionResourceInfo::HasIndirectCall, llvm::AMDGPUResourceUsageAnalysis::SIFunctionResourceInfo::HasRecursion, llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::AMDGPU::isEntryFunctionCC(), llvm::MCExpr::isSymbolUsedInExpression(), llvm::MCSymbol::isVariable(), llvm::AMDGPUResourceUsageAnalysis::SIFunctionResourceInfo::NumAGPR, llvm::AMDGPUResourceUsageAnalysis::SIFunctionResourceInfo::NumExplicitSGPR, llvm::AMDGPUResourceUsageAnalysis::SIFunctionResourceInfo::NumVGPR, llvm::AMDGPUResourceUsageAnalysis::SIFunctionResourceInfo::PrivateSegmentSize, llvm::SmallVectorTemplateBase< T, bool >::push_back(), RIK_HasDynSizedStack, RIK_HasIndirectCall, RIK_HasRecursion, RIK_NumAGPR, RIK_NumSGPR, RIK_NumVGPR, RIK_PrivateSegSize, RIK_UsesFlatScratch, RIK_UsesVCC, llvm::MCSymbol::setVariableValue(), Sym, llvm::AMDGPUResourceUsageAnalysis::SIFunctionResourceInfo::UsesFlatScratch, and llvm::AMDGPUResourceUsageAnalysis::SIFunctionResourceInfo::UsesVCC.

Referenced by llvm::AMDGPUAsmPrinter::runOnMachineFunction().

◆ getMaxAGPRSymbol()

MCSymbol * MCResourceInfo::getMaxAGPRSymbol ( MCContext OutContext)

◆ getMaxSGPRSymbol()

MCSymbol * MCResourceInfo::getMaxSGPRSymbol ( MCContext OutContext)

◆ getMaxVGPRSymbol()

MCSymbol * MCResourceInfo::getMaxVGPRSymbol ( MCContext OutContext)

◆ getSymbol()

MCSymbol * MCResourceInfo::getSymbol ( StringRef  FuncName,
ResourceInfoKind  RIK,
MCContext OutContext 
)

◆ getSymRefExpr()

const MCExpr * MCResourceInfo::getSymRefExpr ( StringRef  FuncName,
ResourceInfoKind  RIK,
MCContext Ctx 
)

◆ reset()

void MCResourceInfo::reset ( )

Definition at line 74 of file AMDGPUMCResourceInfo.cpp.

References MCResourceInfo().

Referenced by llvm::AMDGPUAsmPrinter::doFinalization().


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