LLVM 20.0.0git
|
#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) |
MCSymbol * | getSymbol (StringRef FuncName, ResourceInfoKind RIK, MCContext &OutContext) |
const MCExpr * | getSymRefExpr (StringRef FuncName, ResourceInfoKind RIK, MCContext &Ctx) |
void | reset () |
void | finalize (MCContext &OutContext) |
MCSymbol * | getMaxVGPRSymbol (MCContext &OutContext) |
MCSymbol * | getMaxAGPRSymbol (MCContext &OutContext) |
MCSymbol * | getMaxSGPRSymbol (MCContext &OutContext) |
void | gatherResourceInfo (const MachineFunction &MF, const AMDGPUResourceUsageAnalysis::SIFunctionResourceInfo &FRI, MCContext &OutContext) |
AMDGPUResourceUsageAnalysis gathers resource usage on a per-function granularity. | |
const MCExpr * | createTotalNumVGPRs (const MachineFunction &MF, MCContext &Ctx) |
const MCExpr * | createTotalNumSGPRs (const MachineFunction &MF, bool hasXnack, MCContext &Ctx) |
Definition at line 28 of file AMDGPUMCResourceInfo.h.
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.
|
default |
Referenced by reset().
|
inline |
Definition at line 66 of file AMDGPUMCResourceInfo.h.
Referenced by gatherResourceInfo().
|
inline |
Definition at line 69 of file AMDGPUMCResourceInfo.h.
Referenced by gatherResourceInfo().
|
inline |
Definition at line 63 of file AMDGPUMCResourceInfo.h.
Referenced by gatherResourceInfo().
const MCExpr * MCResourceInfo::createTotalNumSGPRs | ( | const MachineFunction & | MF, |
bool | hasXnack, | ||
MCContext & | Ctx | ||
) |
Definition at line 263 of file AMDGPUMCResourceInfo.cpp.
References llvm::MCBinaryExpr::createAdd(), llvm::AMDGPUMCExpr::createExtraSGPRs(), llvm::MachineFunction::getFunction(), llvm::MCSymbol::getName(), getSymRefExpr(), llvm::MachineFunction::getTarget(), RIK_NumSGPR, RIK_UsesFlatScratch, and RIK_UsesVCC.
Referenced by llvm::AMDGPUAsmPrinter::runOnMachineFunction().
const MCExpr * MCResourceInfo::createTotalNumVGPRs | ( | const MachineFunction & | MF, |
MCContext & | Ctx | ||
) |
Definition at line 254 of file AMDGPUMCResourceInfo.cpp.
References llvm::AMDGPUMCExpr::createTotalNumVGPR(), llvm::MachineFunction::getFunction(), llvm::MCSymbol::getName(), getSymRefExpr(), llvm::MachineFunction::getTarget(), RIK_NumAGPR, and RIK_NumVGPR.
Referenced by llvm::AMDGPUAsmPrinter::runOnMachineFunction().
void MCResourceInfo::finalize | ( | MCContext & | OutContext | ) |
Definition at line 76 of file AMDGPUMCResourceInfo.cpp.
References assert().
Referenced by llvm::AMDGPUAsmPrinter::doFinalization().
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().
Definition at line 86 of file AMDGPUMCResourceInfo.cpp.
References llvm::MCContext::getOrCreateSymbol().
Referenced by llvm::AMDGPUAsmPrinter::doFinalization(), and gatherResourceInfo().
Definition at line 90 of file AMDGPUMCResourceInfo.cpp.
References llvm::MCContext::getOrCreateSymbol().
Referenced by llvm::AMDGPUAsmPrinter::doFinalization(), and gatherResourceInfo().
Definition at line 82 of file AMDGPUMCResourceInfo.cpp.
References llvm::MCContext::getOrCreateSymbol().
Referenced by llvm::AMDGPUAsmPrinter::doFinalization(), and gatherResourceInfo().
MCSymbol * MCResourceInfo::getSymbol | ( | StringRef | FuncName, |
ResourceInfoKind | RIK, | ||
MCContext & | OutContext | ||
) |
Definition at line 24 of file AMDGPUMCResourceInfo.cpp.
References llvm::MCContext::getOrCreateSymbol(), llvm_unreachable, RIK_HasDynSizedStack, RIK_HasIndirectCall, RIK_HasRecursion, RIK_NumAGPR, RIK_NumSGPR, RIK_NumVGPR, RIK_PrivateSegSize, RIK_UsesFlatScratch, and RIK_UsesVCC.
Referenced by gatherResourceInfo(), getSymRefExpr(), and llvm::AMDGPUAsmPrinter::runOnMachineFunction().
const MCExpr * MCResourceInfo::getSymRefExpr | ( | StringRef | FuncName, |
ResourceInfoKind | RIK, | ||
MCContext & | Ctx | ||
) |
Definition at line 52 of file AMDGPUMCResourceInfo.cpp.
References llvm::MCSymbolRefExpr::create(), and getSymbol().
Referenced by createTotalNumSGPRs(), and createTotalNumVGPRs().
void MCResourceInfo::reset | ( | ) |
Definition at line 74 of file AMDGPUMCResourceInfo.cpp.
References MCResourceInfo().
Referenced by llvm::AMDGPUAsmPrinter::doFinalization().