LLVM  14.0.0git
Macros | Functions | Variables
AMDGPUResourceUsageAnalysis.cpp File Reference

Analyzes how many registers and other resources are used by functions. More...

#include "AMDGPUResourceUsageAnalysis.h"
#include "AMDGPU.h"
#include "GCNSubtarget.h"
#include "SIMachineFunctionInfo.h"
#include "llvm/Analysis/CallGraph.h"
#include "llvm/CodeGen/TargetPassConfig.h"
#include "llvm/Target/TargetMachine.h"
Include dependency graph for AMDGPUResourceUsageAnalysis.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "amdgpu-resource-usage"
 

Functions

 INITIALIZE_PASS (AMDGPUResourceUsageAnalysis, DEBUG_TYPE, "Function register usage analysis", true, true) static const Function *getCalleeFunction(const MachineOperand &Op)
 
static bool hasAnyNonFlatUseOfReg (const MachineRegisterInfo &MRI, const SIInstrInfo &TII, unsigned Reg)
 

Variables

static cl::opt< uint32_tAssumedStackSizeForExternalCall ("amdgpu-assume-external-call-stack-size", cl::desc("Assumed stack use of any external call (in bytes)"), cl::Hidden, cl::init(16384))
 
static cl::opt< uint32_tAssumedStackSizeForDynamicSizeObjects ("amdgpu-assume-dynamic-stack-object-size", cl::desc("Assumed extra stack use if there are any " "variable sized objects (in bytes)"), cl::Hidden, cl::init(4096))
 

Detailed Description

Analyzes how many registers and other resources are used by functions.

The results of this analysis are used to fill the register usage, flat usage, etc. into hardware registers.

The analysis takes callees into account. E.g. if a function A that needs 10 VGPRs calls a function B that needs 20 VGPRs, querying the VGPR usage of A will return 20. It is assumed that an indirect call can go into any function except hardware-entrypoints. Therefore the register usage of functions with indirect calls is estimated as the maximum of all non-entrypoint functions in the module.

Definition in file AMDGPUResourceUsageAnalysis.cpp.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "amdgpu-resource-usage"

Definition at line 37 of file AMDGPUResourceUsageAnalysis.cpp.

Function Documentation

◆ hasAnyNonFlatUseOfReg()

static bool hasAnyNonFlatUseOfReg ( const MachineRegisterInfo MRI,
const SIInstrInfo TII,
unsigned  Reg 
)
static

◆ INITIALIZE_PASS()

INITIALIZE_PASS ( AMDGPUResourceUsageAnalysis  ,
DEBUG_TYPE  ,
"Function register usage analysis ,
true  ,
true   
) const &

Definition at line 56 of file AMDGPUResourceUsageAnalysis.cpp.

References assert().

Variable Documentation

◆ AssumedStackSizeForDynamicSizeObjects

cl::opt<uint32_t> AssumedStackSizeForDynamicSizeObjects("amdgpu-assume-dynamic-stack-object-size", cl::desc("Assumed extra stack use if there are any " "variable sized objects (in bytes)"), cl::Hidden, cl::init(4096))
static

◆ AssumedStackSizeForExternalCall

cl::opt<uint32_t> AssumedStackSizeForExternalCall("amdgpu-assume-external-call-stack-size", cl::desc("Assumed stack use of any external call (in bytes)"), cl::Hidden, cl::init(16384))
static