LLVM 23.0.0git
llvm::MCResourceInfo Class Reference

#include "Target/AMDGPU/AMDGPUMCResourceInfo.h"

Public Types

enum  ResourceInfoKind {
  RIK_NumVGPR , RIK_NumAGPR , RIK_NumSGPR , RIK_NumNamedBarrier ,
  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)
void addMaxNamedBarrierCandidate (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)
MCSymbolgetMaxNamedBarrierSymbol (MCContext &OutContext)
void gatherResourceInfo (const MachineFunction &MF, const AMDGPUResourceUsageAnalysisWrapperPass::FunctionResourceInfo &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_NumNamedBarrier 
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 74 of file AMDGPUMCResourceInfo.h.

Referenced by gatherResourceInfo().

◆ addMaxNamedBarrierCandidate()

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

Definition at line 80 of file AMDGPUMCResourceInfo.h.

Referenced by gatherResourceInfo().

◆ addMaxSGPRCandidate()

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

Definition at line 77 of file AMDGPUMCResourceInfo.h.

Referenced by gatherResourceInfo().

◆ addMaxVGPRCandidate()

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

Definition at line 71 of file AMDGPUMCResourceInfo.h.

Referenced by gatherResourceInfo().

◆ createTotalNumSGPRs()

◆ createTotalNumVGPRs()

◆ finalize()

void MCResourceInfo::finalize ( MCContext & OutContext)

Definition at line 86 of file AMDGPUMCResourceInfo.cpp.

References assert().

◆ gatherResourceInfo()

void MCResourceInfo::gatherResourceInfo ( const MachineFunction & MF,
const AMDGPUResourceUsageAnalysisWrapperPass::FunctionResourceInfo & 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.

When link-time object linking is enabled, skip all call-transitive propagation and emit concrete per-function values for every resource symbol. Cross-TU aggregation is then the linker's responsibility.

Definition at line 249 of file AMDGPUMCResourceInfo.cpp.

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

◆ getMaxAGPRSymbol()

MCSymbol * MCResourceInfo::getMaxAGPRSymbol ( MCContext & OutContext)

Definition at line 96 of file AMDGPUMCResourceInfo.cpp.

References llvm::MCContext::getOrCreateSymbol().

Referenced by gatherResourceInfo().

◆ getMaxNamedBarrierSymbol()

MCSymbol * MCResourceInfo::getMaxNamedBarrierSymbol ( MCContext & OutContext)

Definition at line 104 of file AMDGPUMCResourceInfo.cpp.

References llvm::MCContext::getOrCreateSymbol().

Referenced by gatherResourceInfo().

◆ getMaxSGPRSymbol()

MCSymbol * MCResourceInfo::getMaxSGPRSymbol ( MCContext & OutContext)

Definition at line 100 of file AMDGPUMCResourceInfo.cpp.

References llvm::MCContext::getOrCreateSymbol().

Referenced by gatherResourceInfo().

◆ getMaxVGPRSymbol()

MCSymbol * MCResourceInfo::getMaxVGPRSymbol ( MCContext & OutContext)

Definition at line 92 of file AMDGPUMCResourceInfo.cpp.

References llvm::MCContext::getOrCreateSymbol().

Referenced by gatherResourceInfo().

◆ getSymbol()

◆ getSymRefExpr()

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

◆ reset()

void MCResourceInfo::reset ( )

Definition at line 84 of file AMDGPUMCResourceInfo.cpp.

References MCResourceInfo().


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