LLVM 24.0.0git
AMDGPUTargetMachine.cpp File Reference

This file contains both AMDGPU target machine and the CodeGen pass builder. More...

#include "AMDGPUTargetMachine.h"
#include "AMDGPU.h"
#include "AMDGPUAliasAnalysis.h"
#include "AMDGPUAsmPrinter.h"
#include "AMDGPUBarrierLatency.h"
#include "AMDGPUCoExecSchedStrategy.h"
#include "AMDGPUCtorDtorLowering.h"
#include "AMDGPUExportClustering.h"
#include "AMDGPUExportKernelRuntimeHandles.h"
#include "AMDGPUHazardLatency.h"
#include "AMDGPUIGroupLP.h"
#include "AMDGPUISelDAGToDAG.h"
#include "AMDGPULowerVGPREncoding.h"
#include "AMDGPUMacroFusion.h"
#include "AMDGPUNextUseAnalysis.h"
#include "AMDGPUPerfHintAnalysis.h"
#include "AMDGPUPreloadKernArgProlog.h"
#include "AMDGPUPrepareAGPRAlloc.h"
#include "AMDGPURemoveIncompatibleFunctions.h"
#include "AMDGPUReserveWWMRegs.h"
#include "AMDGPUResourceUsageAnalysis.h"
#include "AMDGPUSplitModule.h"
#include "AMDGPUTargetObjectFile.h"
#include "AMDGPUTargetTransformInfo.h"
#include "AMDGPUUnifyDivergentExitNodes.h"
#include "AMDGPUWaitSGPRHazards.h"
#include "GCNDPPCombine.h"
#include "GCNIterativeScheduler.h"
#include "GCNNSAReassign.h"
#include "GCNPreRALongBranchReg.h"
#include "GCNPreRAOptimizations.h"
#include "GCNRewritePartialRegUses.h"
#include "GCNSchedStrategy.h"
#include "GCNVOPDUtils.h"
#include "R600.h"
#include "R600TargetMachine.h"
#include "SIFixSGPRCopies.h"
#include "SIFixVGPRCopies.h"
#include "SIFoldOperands.h"
#include "SIFormMemoryClauses.h"
#include "SILoadStoreOptimizer.h"
#include "SILowerControlFlow.h"
#include "SILowerSGPRSpills.h"
#include "SILowerWWMCopies.h"
#include "SIMachineFunctionInfo.h"
#include "SIMachineScheduler.h"
#include "SIOptimizeExecMasking.h"
#include "SIOptimizeExecMaskingPreRA.h"
#include "SIOptimizeVGPRLiveRange.h"
#include "SIPeepholeSDWA.h"
#include "SIPostRABundler.h"
#include "SIPreAllocateWWMRegs.h"
#include "SIShrinkInstructions.h"
#include "SIWholeQuadMode.h"
#include "TargetInfo/AMDGPUTargetInfo.h"
#include "Utils/AMDGPUBaseInfo.h"
#include "llvm/Analysis/CGSCCPassManager.h"
#include "llvm/Analysis/KernelInfo.h"
#include "llvm/CodeGen/AtomicExpand.h"
#include "llvm/CodeGen/BranchRelaxation.h"
#include "llvm/CodeGen/DeadMachineInstructionElim.h"
#include "llvm/CodeGen/DetectDeadLanes.h"
#include "llvm/CodeGen/EarlyIfConversion.h"
#include "llvm/CodeGen/FuncletLayout.h"
#include "llvm/CodeGen/GCMetadata.h"
#include "llvm/CodeGen/GlobalISel/CSEInfo.h"
#include "llvm/CodeGen/GlobalISel/IRTranslator.h"
#include "llvm/CodeGen/GlobalISel/InstructionSelect.h"
#include "llvm/CodeGen/GlobalISel/Legalizer.h"
#include "llvm/CodeGen/GlobalISel/Localizer.h"
#include "llvm/CodeGen/MIRParser/MIParser.h"
#include "llvm/CodeGen/MachineCSE.h"
#include "llvm/CodeGen/MachineLICM.h"
#include "llvm/CodeGen/MachinePipeliner.h"
#include "llvm/CodeGen/MachineScheduler.h"
#include "llvm/CodeGen/PHIElimination.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/PatchableFunction.h"
#include "llvm/CodeGen/PostRAHazardRecognizer.h"
#include "llvm/CodeGen/RegAllocGreedyPass.h"
#include "llvm/CodeGen/RegAllocRegistry.h"
#include "llvm/CodeGen/RenameIndependentSubregs.h"
#include "llvm/CodeGen/ShadowStackGCLowering.h"
#include "llvm/CodeGen/StackSlotColoring.h"
#include "llvm/CodeGen/TargetPassConfig.h"
#include "llvm/CodeGen/TwoAddressInstructionPass.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/IntrinsicsAMDGPU.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/PassManager.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/InitializePasses.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Option/LibraryOptions.h"
#include "llvm/Passes/CodeGenPassBuilder.h"
#include "llvm/Passes/PassBuilder.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/TargetParser/AMDGPUTargetParser.h"
#include "llvm/Transforms/HipStdPar/HipStdPar.h"
#include "llvm/Transforms/IPO.h"
#include "llvm/Transforms/IPO/AlwaysInliner.h"
#include "llvm/Transforms/IPO/ExpandVariadics.h"
#include "llvm/Transforms/IPO/GlobalDCE.h"
#include "llvm/Transforms/IPO/Internalize.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Scalar/EarlyCSE.h"
#include "llvm/Transforms/Scalar/FlattenCFG.h"
#include "llvm/Transforms/Scalar/GVN.h"
#include "llvm/Transforms/Scalar/InferAddressSpaces.h"
#include "llvm/Transforms/Scalar/LICM.h"
#include "llvm/Transforms/Scalar/LoopDataPrefetch.h"
#include "llvm/Transforms/Scalar/LoopPassManager.h"
#include "llvm/Transforms/Scalar/NaryReassociate.h"
#include "llvm/Transforms/Scalar/SeparateConstOffsetFromGEP.h"
#include "llvm/Transforms/Scalar/Sink.h"
#include "llvm/Transforms/Scalar/StraightLineStrengthReduce.h"
#include "llvm/Transforms/Scalar/StructurizeCFG.h"
#include "llvm/Transforms/Utils.h"
#include "llvm/Transforms/Utils/FixIrreducible.h"
#include "llvm/Transforms/Utils/LCSSA.h"
#include "llvm/Transforms/Utils/LowerSwitch.h"
#include "llvm/Transforms/Utils/SimplifyLibCalls.h"
#include "llvm/Transforms/Utils/UnifyLoopExits.h"
#include "llvm/Transforms/Vectorize/LoadStoreVectorizer.h"
#include <optional>
#include "llvm/Passes/TargetPassRegistry.inc"

Go to the source code of this file.

Macros

#define GET_PASS_REGISTRY   "AMDGPUPassRegistry.def"
#define ADD_CLASS_PASS_TO_PASS_NAME(NAME, CREATE_PASS)
#define ADD_CLASS_PASS_TO_PASS_NAME_WITH_PARAMS(NAME, CLASS)
#define MODULE_ANALYSIS(NAME, CREATE_PASS)
#define MODULE_PASS(NAME, CREATE_PASS)
#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS)
#define FUNCTION_ANALYSIS(NAME, CREATE_PASS)
#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS)
#define FUNCTION_PASS(NAME, CREATE_PASS)
#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS)
#define LOOP_ANALYSIS(NAME, CREATE_PASS)
#define LOOP_PASS(NAME, CREATE_PASS)
#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS)
#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS)
#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS)
#define ADD_PASS(NAME, CREATE_PASS)
#define ADD_PASS_WITH_PARAMS(NAME, CREATE_PASS, PARSER)
#define ADD_ANALYSIS_PASS(NAME, CREATE_PASS)
#define MODULE_PASS(NAME, CREATE_PASS)
#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS)
#define FUNCTION_PASS(NAME, CREATE_PASS)
#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS)
#define LOOP_PASS(NAME, CREATE_PASS)
#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS)
#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS)
#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS)
#define MODULE_ANALYSIS(NAME, CREATE_PASS)
#define FUNCTION_ANALYSIS(NAME, CREATE_PASS)
#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS)
#define LOOP_ANALYSIS(NAME, CREATE_PASS)
#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS)

Enumerations

enum class  OOBFlagValue { Any = 0 , Relaxed = 1 , Strict = 2 }

Functions

static bool onlyAllocateSGPRs (const TargetRegisterInfo &TRI, const MachineRegisterInfo &MRI, const Register Reg)
static bool onlyAllocateVGPRs (const TargetRegisterInfo &TRI, const MachineRegisterInfo &MRI, const Register Reg)
static bool onlyAllocateWWMRegs (const TargetRegisterInfo &TRI, const MachineRegisterInfo &MRI, const Register Reg)
static FunctionPass * useDefaultRegisterAllocator ()
 -{sgpr|wwm|vgpr}-regalloc=... command line option.
static SGPRRegisterRegAlloc defaultSGPRRegAlloc ("default", "pick SGPR register allocator based on -O option", useDefaultRegisterAllocator)
static Error checkRegAllocSupported (RegAllocType RAType, StringRef RegName)
 Check if the given RegAllocType is supported for AMDGPU NPM register allocation.
static void initializeDefaultSGPRRegisterAllocatorOnce ()
static void initializeDefaultVGPRRegisterAllocatorOnce ()
static void initializeDefaultWWMRegisterAllocatorOnce ()
static FunctionPass * createBasicSGPRRegisterAllocator ()
static FunctionPass * createGreedySGPRRegisterAllocator ()
static FunctionPass * createFastSGPRRegisterAllocator ()
static FunctionPass * createBasicVGPRRegisterAllocator ()
static FunctionPass * createGreedyVGPRRegisterAllocator ()
static FunctionPass * createFastVGPRRegisterAllocator ()
static FunctionPass * createBasicWWMRegisterAllocator ()
static FunctionPass * createGreedyWWMRegisterAllocator ()
static FunctionPass * createFastWWMRegisterAllocator ()
static SGPRRegisterRegAlloc basicRegAllocSGPR ("basic", "basic register allocator", createBasicSGPRRegisterAllocator)
static SGPRRegisterRegAlloc greedyRegAllocSGPR ("greedy", "greedy register allocator", createGreedySGPRRegisterAllocator)
static SGPRRegisterRegAlloc fastRegAllocSGPR ("fast", "fast register allocator", createFastSGPRRegisterAllocator)
static VGPRRegisterRegAlloc basicRegAllocVGPR ("basic", "basic register allocator", createBasicVGPRRegisterAllocator)
static VGPRRegisterRegAlloc greedyRegAllocVGPR ("greedy", "greedy register allocator", createGreedyVGPRRegisterAllocator)
static VGPRRegisterRegAlloc fastRegAllocVGPR ("fast", "fast register allocator", createFastVGPRRegisterAllocator)
static WWMRegisterRegAlloc basicRegAllocWWMReg ("basic", "basic register allocator", createBasicWWMRegisterAllocator)
static WWMRegisterRegAlloc greedyRegAllocWWMReg ("greedy", "greedy register allocator", createGreedyWWMRegisterAllocator)
static WWMRegisterRegAlloc fastRegAllocWWMReg ("fast", "fast register allocator", createFastWWMRegisterAllocator)
static bool isLTOPreLink (ThinOrFullLTOPhase Phase)
static void diagnoseUnsupportedCoExecSchedulerSelection (const Function &F, const GCNSubtarget &ST)
static bool useNoopPostScheduler (const AMDGPUOptions &CLOpts, const Function &F)
LLVM_ABI LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAMDGPUTarget ()
static std::unique_ptr< TargetLoweringObjectFile > createTLOF (const Triple &TT)
static ScheduleDAGInstrs * createSIMachineScheduler (MachineSchedContext *C)
static ScheduleDAGInstrs * createGCNMaxOccupancyMachineScheduler (MachineSchedContext *C)
static ScheduleDAGInstrs * createGCNMaxILPMachineScheduler (MachineSchedContext *C)
static ScheduleDAGInstrs * createGCNMaxMemoryClauseMachineScheduler (MachineSchedContext *C)
static ScheduleDAGInstrs * createIterativeGCNMaxOccupancyMachineScheduler (MachineSchedContext *C)
static ScheduleDAGInstrs * createMinRegScheduler (MachineSchedContext *C)
static ScheduleDAGInstrs * createIterativeILPMachineScheduler (MachineSchedContext *C)
static LLVM_READNONE StringRef getGPUOrDefault (const Triple &TT, StringRef GPU)
static Reloc::Model getEffectiveRelocModel ()
static bool mustPreserveGV (const GlobalValue &GV)
 Predicate for Internalize pass.
static Expected< AMDGPU::ScanOptions > parseAMDGPUAtomicOptimizerStrategy (StringRef Params)
Expected< AMDGPUAttributorOptions > parseAMDGPUAttributorPassOptions (StringRef Params)
static OOBFlagValue getOOBFlagValue (const Module &M, StringRef FlagName)
 Returns the OOB mode encoded by a module flag.
static bool mayNeedAsyncBarrierArriveWorkaround (const Triple &TT)

Variables

static llvm::once_flag InitializeDefaultSGPRRegisterAllocatorFlag
 A dummy default pass factory indicates whether the register allocator is overridden on the command line.
static llvm::once_flag InitializeDefaultVGPRRegisterAllocatorFlag
static llvm::once_flag InitializeDefaultWWMRegisterAllocatorFlag
static cl::opt< SGPRRegisterRegAlloc::FunctionPassCtor, false, RegisterPassParser< SGPRRegisterRegAlloc > > SGPRRegAlloc ("sgpr-regalloc", cl::Hidden, cl::init(&useDefaultRegisterAllocator), cl::desc("Register allocator to use for SGPRs"))
static cl::opt< VGPRRegisterRegAlloc::FunctionPassCtor, false, RegisterPassParser< VGPRRegisterRegAlloc > > VGPRRegAlloc ("vgpr-regalloc", cl::Hidden, cl::init(&useDefaultRegisterAllocator), cl::desc("Register allocator to use for VGPRs"))
static cl::opt< WWMRegisterRegAlloc::FunctionPassCtor, false, RegisterPassParser< WWMRegisterRegAlloc > > WWMRegAlloc ("wwm-regalloc", cl::Hidden, cl::init(&useDefaultRegisterAllocator), cl::desc("Register allocator to use for WWM registers"))
static cl::opt< RegAllocType, false, RegAllocTypeParser > SGPRRegAllocNPM ("sgpr-regalloc-npm", cl::Hidden, cl::init(RegAllocType::Default), cl::desc("Register allocator for SGPRs (new pass manager)"))
static cl::opt< RegAllocType, false, RegAllocTypeParser > VGPRRegAllocNPM ("vgpr-regalloc-npm", cl::Hidden, cl::init(RegAllocType::Default), cl::desc("Register allocator for VGPRs (new pass manager)"))
static cl::opt< RegAllocType, false, RegAllocTypeParser > WWMRegAllocNPM ("wwm-regalloc-npm", cl::Hidden, cl::init(RegAllocType::Default), cl::desc("Register allocator for WWM registers (new pass manager)"))
static cl::opt< bool, true > EnableObjectLinking ("amdgpu-enable-object-linking", cl::desc("Enable object linking for cross-TU LDS and ABI support"), cl::location(AMDGPUTargetMachine::EnableObjectLinking), cl::init(false), cl::Hidden)
static cl::opt< bool, true > EnableLowerModuleLDS ("amdgpu-enable-lower-module-lds", cl::desc("Enable lower module lds pass"), cl::location(AMDGPUTargetMachine::EnableLowerModuleLDS), cl::init(true), cl::Hidden)
static MachineSchedRegistry SISchedRegistry ("si", "Run SI's custom scheduler", createSIMachineScheduler)
static MachineSchedRegistry GCNMaxOccupancySchedRegistry ("gcn-max-occupancy", "Run GCN scheduler to maximize occupancy", createGCNMaxOccupancyMachineScheduler)
static MachineSchedRegistry GCNMaxILPSchedRegistry ("gcn-max-ilp", "Run GCN scheduler to maximize ilp", createGCNMaxILPMachineScheduler)
static MachineSchedRegistry GCNMaxMemoryClauseSchedRegistry ("gcn-max-memory-clause", "Run GCN scheduler to maximize memory clause", createGCNMaxMemoryClauseMachineScheduler)
static MachineSchedRegistry IterativeGCNMaxOccupancySchedRegistry ("gcn-iterative-max-occupancy-experimental", "Run GCN scheduler to maximize occupancy (experimental)", createIterativeGCNMaxOccupancyMachineScheduler)
static MachineSchedRegistry GCNMinRegSchedRegistry ("gcn-iterative-minreg", "Run GCN iterative scheduler for minimal register usage (experimental)", createMinRegScheduler)
static MachineSchedRegistry GCNILPSchedRegistry ("gcn-iterative-ilp", "Run GCN iterative scheduler for ILP scheduling (experimental)", createIterativeILPMachineScheduler)
static const char RegAllocOptNotSupportedMessage []

Detailed Description

This file contains both AMDGPU target machine and the CodeGen pass builder.

The AMDGPU target machine contains all of the hardware specific information needed to emit code for SI+ GPUs in the legacy pass manager pipeline. The CodeGen pass builder handles the pass pipeline for new pass manager.

Definition in file AMDGPUTargetMachine.cpp.

Macro Definition Documentation

◆ ADD_ANALYSIS_PASS

#define ADD_ANALYSIS_PASS ( NAME,
CREATE_PASS )
Value:
if (Name == "invalidate<" NAME ">") { \
PM.addPass(InvalidateAnalysisPass< \
std::remove_reference_t<decltype(CREATE_PASS)>>()); \
return true; \
} \
if (Name == "require<" NAME ">") { \
PM.addPass( \
RequireAnalysisPass<std::remove_reference_t<decltype(CREATE_PASS)>, \
return true; \
}
A no-op pass template which simply forces a specific analysis result to be invalidated.
A utility pass template to force an analysis result to be available.

◆ ADD_CLASS_PASS_TO_PASS_NAME

#define ADD_CLASS_PASS_TO_PASS_NAME ( NAME,
CREATE_PASS )
Value:
PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
PassInstrumentationCallbacks PIC
static const char * name

◆ ADD_CLASS_PASS_TO_PASS_NAME_WITH_PARAMS

#define ADD_CLASS_PASS_TO_PASS_NAME_WITH_PARAMS ( NAME,
CLASS )
Value:
PIC->addClassToPassName(CLASS, NAME);

◆ ADD_PASS

#define ADD_PASS ( NAME,
CREATE_PASS )
Value:
if (Name == NAME) { \
PM.addPass(CREATE_PASS); \
return true; \
}

◆ ADD_PASS_WITH_PARAMS

#define ADD_PASS_WITH_PARAMS ( NAME,
CREATE_PASS,
PARSER )
Value:
auto Params = PassBuilder::parsePassParameters(PARSER, Name, NAME); \
if (!Params) { \
errs() << NAME ": " << toString(Params.takeError()) << '\n'; \
return false; \
} \
PM.addPass(CREATE_PASS(Params.get())); \
return true; \
}
static bool checkParametrizedPassName(StringRef Name, StringRef PassName)
static auto parsePassParameters(ParametersParseCallableT &&Parser, StringRef Name, StringRef PassName) -> decltype(Parser(StringRef{}))
This performs customized parsing of pass name with parameters.
std::string toString(const APInt &I, unsigned Radix, bool Signed, bool formatAsCLiteral=false, bool UpperCase=true, bool InsertSeparators=false)

◆ FUNCTION_ALIAS_ANALYSIS [1/2]

#define FUNCTION_ALIAS_ANALYSIS ( NAME,
CREATE_PASS )
Value:
ADD_CLASS_PASS_TO_PASS_NAME(NAME, CREATE_PASS)
#define ADD_CLASS_PASS_TO_PASS_NAME(NAME, CREATE_PASS)

◆ FUNCTION_ALIAS_ANALYSIS [2/2]

#define FUNCTION_ALIAS_ANALYSIS ( NAME,
CREATE_PASS )
Value:
if (Name == NAME) { \
AM.registerFunctionAnalysis< \
std::remove_reference_t<decltype(CREATE_PASS)>>(); \
return true; \
}

◆ FUNCTION_ANALYSIS [1/2]

#define FUNCTION_ANALYSIS ( NAME,
CREATE_PASS )
Value:
ADD_CLASS_PASS_TO_PASS_NAME(NAME, CREATE_PASS)

◆ FUNCTION_ANALYSIS [2/2]

#define FUNCTION_ANALYSIS ( NAME,
CREATE_PASS )
Value:
AM.registerPass([&] { return CREATE_PASS; });

◆ FUNCTION_PASS [1/2]

#define FUNCTION_PASS ( NAME,
CREATE_PASS )
Value:
ADD_CLASS_PASS_TO_PASS_NAME(NAME, CREATE_PASS)

◆ FUNCTION_PASS [2/2]

#define FUNCTION_PASS ( NAME,
CREATE_PASS )
Value:
ADD_PASS(NAME, CREATE_PASS)
#define ADD_PASS(NAME, CREATE_PASS)

◆ FUNCTION_PASS_WITH_PARAMS [1/2]

#define FUNCTION_PASS_WITH_PARAMS ( NAME,
CLASS,
CREATE_PASS,
PARSER,
PARAMS )
Value:
#define ADD_CLASS_PASS_TO_PASS_NAME_WITH_PARAMS(NAME, CLASS)

◆ FUNCTION_PASS_WITH_PARAMS [2/2]

#define FUNCTION_PASS_WITH_PARAMS ( NAME,
CLASS,
CREATE_PASS,
PARSER,
PARAMS )
Value:
ADD_PASS_WITH_PARAMS(NAME, CREATE_PASS, PARSER)
#define ADD_PASS_WITH_PARAMS(NAME, CREATE_PASS, PARSER)

◆ GET_PASS_REGISTRY

#define GET_PASS_REGISTRY   "AMDGPUPassRegistry.def"

◆ LOOP_ANALYSIS [1/2]

#define LOOP_ANALYSIS ( NAME,
CREATE_PASS )
Value:
ADD_CLASS_PASS_TO_PASS_NAME(NAME, CREATE_PASS)

◆ LOOP_ANALYSIS [2/2]

#define LOOP_ANALYSIS ( NAME,
CREATE_PASS )
Value:
AM.registerPass([&] { return CREATE_PASS; });

◆ LOOP_PASS [1/2]

#define LOOP_PASS ( NAME,
CREATE_PASS )
Value:
ADD_CLASS_PASS_TO_PASS_NAME(NAME, CREATE_PASS)

◆ LOOP_PASS [2/2]

#define LOOP_PASS ( NAME,
CREATE_PASS )
Value:
ADD_PASS(NAME, CREATE_PASS)

◆ MACHINE_FUNCTION_ANALYSIS [1/3]

#define MACHINE_FUNCTION_ANALYSIS ( NAME,
CREATE_PASS )
Value:
ADD_CLASS_PASS_TO_PASS_NAME(NAME, CREATE_PASS)

◆ MACHINE_FUNCTION_ANALYSIS [2/3]

#define MACHINE_FUNCTION_ANALYSIS ( NAME,
CREATE_PASS )
Value:
ADD_ANALYSIS_PASS(NAME, CREATE_PASS)
#define ADD_ANALYSIS_PASS(NAME, CREATE_PASS)

◆ MACHINE_FUNCTION_ANALYSIS [3/3]

#define MACHINE_FUNCTION_ANALYSIS ( NAME,
CREATE_PASS )
Value:
AM.registerPass([&] { return CREATE_PASS; });

◆ MACHINE_FUNCTION_PASS [1/2]

#define MACHINE_FUNCTION_PASS ( NAME,
CREATE_PASS )
Value:
ADD_CLASS_PASS_TO_PASS_NAME(NAME, CREATE_PASS)

◆ MACHINE_FUNCTION_PASS [2/2]

#define MACHINE_FUNCTION_PASS ( NAME,
CREATE_PASS )
Value:
ADD_PASS(NAME, CREATE_PASS)

◆ MACHINE_FUNCTION_PASS_WITH_PARAMS [1/2]

#define MACHINE_FUNCTION_PASS_WITH_PARAMS ( NAME,
CLASS,
CREATE_PASS,
PARSER,
PARAMS )

◆ MACHINE_FUNCTION_PASS_WITH_PARAMS [2/2]

#define MACHINE_FUNCTION_PASS_WITH_PARAMS ( NAME,
CLASS,
CREATE_PASS,
PARSER,
PARAMS )
Value:
ADD_PASS_WITH_PARAMS(NAME, CREATE_PASS, PARSER)

◆ MODULE_ANALYSIS [1/2]

#define MODULE_ANALYSIS ( NAME,
CREATE_PASS )
Value:
ADD_CLASS_PASS_TO_PASS_NAME(NAME, CREATE_PASS)

◆ MODULE_ANALYSIS [2/2]

#define MODULE_ANALYSIS ( NAME,
CREATE_PASS )
Value:
AM.registerPass([&] { return CREATE_PASS; });

◆ MODULE_PASS [1/2]

#define MODULE_PASS ( NAME,
CREATE_PASS )
Value:
ADD_CLASS_PASS_TO_PASS_NAME(NAME, CREATE_PASS)

◆ MODULE_PASS [2/2]

#define MODULE_PASS ( NAME,
CREATE_PASS )
Value:
ADD_PASS(NAME, CREATE_PASS)

◆ MODULE_PASS_WITH_PARAMS [1/2]

#define MODULE_PASS_WITH_PARAMS ( NAME,
CLASS,
CREATE_PASS,
PARSER,
PARAMS )

◆ MODULE_PASS_WITH_PARAMS [2/2]

#define MODULE_PASS_WITH_PARAMS ( NAME,
CLASS,
CREATE_PASS,
PARSER,
PARAMS )
Value:
ADD_PASS_WITH_PARAMS(NAME, CREATE_PASS, PARSER)

Enumeration Type Documentation

◆ OOBFlagValue

enum class OOBFlagValue
strong
Enumerator
Any 
Relaxed 
Strict 

Definition at line 1103 of file AMDGPUTargetMachine.cpp.

Function Documentation

◆ basicRegAllocSGPR()

SGPRRegisterRegAlloc basicRegAllocSGPR ( "basic" ,
"basic register allocator" ,
createBasicSGPRRegisterAllocator  )
static

◆ basicRegAllocVGPR()

VGPRRegisterRegAlloc basicRegAllocVGPR ( "basic" ,
"basic register allocator" ,
createBasicVGPRRegisterAllocator  )
static

◆ basicRegAllocWWMReg()

WWMRegisterRegAlloc basicRegAllocWWMReg ( "basic" ,
"basic register allocator" ,
createBasicWWMRegisterAllocator  )
static

◆ checkRegAllocSupported()

Error checkRegAllocSupported ( RegAllocType RAType,
StringRef RegName )
static

Check if the given RegAllocType is supported for AMDGPU NPM register allocation.

Only Fast and Greedy are supported; Basic and PBQP are not.

Definition at line 296 of file AMDGPUTargetMachine.cpp.

References llvm::Basic, llvm::inconvertibleErrorCode(), llvm::make_error(), llvm::PBQP, RegName, and llvm::Error::success().

◆ createBasicSGPRRegisterAllocator()

FunctionPass * createBasicSGPRRegisterAllocator ( )
static

◆ createBasicVGPRRegisterAllocator()

FunctionPass * createBasicVGPRRegisterAllocator ( )
static

◆ createBasicWWMRegisterAllocator()

FunctionPass * createBasicWWMRegisterAllocator ( )
static

◆ createFastSGPRRegisterAllocator()

FunctionPass * createFastSGPRRegisterAllocator ( )
static

Definition at line 373 of file AMDGPUTargetMachine.cpp.

References llvm::createFastRegisterAllocator(), and onlyAllocateSGPRs().

Referenced by fastRegAllocSGPR().

◆ createFastVGPRRegisterAllocator()

FunctionPass * createFastVGPRRegisterAllocator ( )
static

Definition at line 385 of file AMDGPUTargetMachine.cpp.

References llvm::createFastRegisterAllocator(), and onlyAllocateVGPRs().

Referenced by fastRegAllocVGPR().

◆ createFastWWMRegisterAllocator()

FunctionPass * createFastWWMRegisterAllocator ( )
static

◆ createGCNMaxILPMachineScheduler()

◆ createGCNMaxMemoryClauseMachineScheduler()

◆ createGCNMaxOccupancyMachineScheduler()

◆ createGreedySGPRRegisterAllocator()

FunctionPass * createGreedySGPRRegisterAllocator ( )
static

◆ createGreedyVGPRRegisterAllocator()

FunctionPass * createGreedyVGPRRegisterAllocator ( )
static

◆ createGreedyWWMRegisterAllocator()

FunctionPass * createGreedyWWMRegisterAllocator ( )
static

◆ createIterativeGCNMaxOccupancyMachineScheduler()

◆ createIterativeILPMachineScheduler()

◆ createMinRegScheduler()

◆ createSIMachineScheduler()

ScheduleDAGInstrs * createSIMachineScheduler ( MachineSchedContext * C)
static

Definition at line 575 of file AMDGPUTargetMachine.cpp.

References C().

Referenced by llvm::GCNTargetMachine::createMachineScheduler().

◆ createTLOF()

std::unique_ptr< TargetLoweringObjectFile > createTLOF ( const Triple & TT)
static

Definition at line 571 of file AMDGPUTargetMachine.cpp.

◆ defaultSGPRRegAlloc()

SGPRRegisterRegAlloc defaultSGPRRegAlloc ( "default" ,
"pick SGPR register allocator based on -O option" ,
useDefaultRegisterAllocator  )
static

◆ diagnoseUnsupportedCoExecSchedulerSelection()

void diagnoseUnsupportedCoExecSchedulerSelection ( const Function & F,
const GCNSubtarget & ST )
static

Definition at line 455 of file AMDGPUTargetMachine.cpp.

References llvm::DS_Warning, and F.

Referenced by llvm::GCNTargetMachine::createMachineScheduler().

◆ fastRegAllocSGPR()

SGPRRegisterRegAlloc fastRegAllocSGPR ( "fast" ,
"fast register allocator" ,
createFastSGPRRegisterAllocator  )
static

◆ fastRegAllocVGPR()

VGPRRegisterRegAlloc fastRegAllocVGPR ( "fast" ,
"fast register allocator" ,
createFastVGPRRegisterAllocator  )
static

◆ fastRegAllocWWMReg()

WWMRegisterRegAlloc fastRegAllocWWMReg ( "fast" ,
"fast register allocator" ,
createFastWWMRegisterAllocator  )
static

◆ getEffectiveRelocModel()

Reloc::Model getEffectiveRelocModel ( )
static

Definition at line 696 of file AMDGPUTargetMachine.cpp.

References llvm::Reloc::PIC_.

◆ getGPUOrDefault()

◆ getOOBFlagValue()

OOBFlagValue getOOBFlagValue ( const Module & M,
StringRef FlagName )
static

Returns the OOB mode encoded by a module flag.

An absent flag defaults to Any.

Definition at line 1111 of file AMDGPUTargetMachine.cpp.

References Any, and llvm::mdconst::dyn_extract_or_null().

Referenced by llvm::GCNTargetMachine::getSubtargetImpl().

◆ greedyRegAllocSGPR()

SGPRRegisterRegAlloc greedyRegAllocSGPR ( "greedy" ,
"greedy register allocator" ,
createGreedySGPRRegisterAllocator  )
static

◆ greedyRegAllocVGPR()

VGPRRegisterRegAlloc greedyRegAllocVGPR ( "greedy" ,
"greedy register allocator" ,
createGreedyVGPRRegisterAllocator  )
static

◆ greedyRegAllocWWMReg()

WWMRegisterRegAlloc greedyRegAllocWWMReg ( "greedy" ,
"greedy register allocator" ,
createGreedyWWMRegisterAllocator  )
static

◆ initializeDefaultSGPRRegisterAllocatorOnce()

void initializeDefaultSGPRRegisterAllocatorOnce ( )
static

Definition at line 338 of file AMDGPUTargetMachine.cpp.

References SGPRRegAlloc.

◆ initializeDefaultVGPRRegisterAllocatorOnce()

void initializeDefaultVGPRRegisterAllocatorOnce ( )
static

Definition at line 347 of file AMDGPUTargetMachine.cpp.

References VGPRRegAlloc.

◆ initializeDefaultWWMRegisterAllocatorOnce()

void initializeDefaultWWMRegisterAllocatorOnce ( )
static

Definition at line 356 of file AMDGPUTargetMachine.cpp.

References WWMRegAlloc.

◆ isLTOPreLink()

bool isLTOPreLink ( ThinOrFullLTOPhase Phase)
static

Definition at line 426 of file AMDGPUTargetMachine.cpp.

References llvm::FullLTOPreLink, Phase, and llvm::ThinLTOPreLink.

◆ LLVMInitializeAMDGPUTarget()

LLVM_ABI LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAMDGPUTarget ( )

Definition at line 475 of file AMDGPUTargetMachine.cpp.

References llvm::PassRegistry::getPassRegistry(), llvm::getTheGCNLegacyTarget(), llvm::getTheGCNTarget(), llvm::getTheR600Target(), llvm::initializeAMDGPUAAWrapperPassPass(), llvm::initializeAMDGPUAlwaysInlinePass(), llvm::initializeAMDGPUAnnotateUniformValuesLegacyPass(), llvm::initializeAMDGPUAsmPrinterPass(), llvm::initializeAMDGPUAtomicOptimizerPass(), llvm::initializeAMDGPUCodeGenPreparePass(), llvm::initializeAMDGPUCtorDtorLoweringLegacyPass(), llvm::initializeAMDGPUDAGToDAGISelLegacyPass(), llvm::initializeAMDGPUExportKernelRuntimeHandlesLegacyPass(), llvm::initializeAMDGPUExternalAAWrapperPass(), llvm::initializeAMDGPUGlobalISelDivergenceLoweringLegacyPass(), llvm::initializeAMDGPUImageIntrinsicOptimizerPass(), llvm::initializeAMDGPUInsertDelayAluLegacyPass(), llvm::initializeAMDGPULateCodeGenPrepareLegacyPass(), llvm::initializeAMDGPULowerBufferFatPointersPass(), llvm::initializeAMDGPULowerExecSyncLegacyPass(), llvm::initializeAMDGPULowerIntrinsicsLegacyPass(), llvm::initializeAMDGPULowerKernelArgumentsPass(), llvm::initializeAMDGPULowerKernelAttributesPass(), llvm::initializeAMDGPULowerModuleLDSLegacyPass(), llvm::initializeAMDGPULowerVGPREncodingLegacyPass(), llvm::initializeAMDGPUMarkLastScratchLoadLegacyPass(), llvm::initializeAMDGPUNextUseAnalysisLegacyPassPass(), llvm::initializeAMDGPUNextUseAnalysisPrinterLegacyPassPass(), llvm::initializeAMDGPUPostLegalizerCombinerLegacyPass(), llvm::initializeAMDGPUPreLegalizerCombinerLegacyPass(), llvm::initializeAMDGPUPreloadKernArgPrologLegacyPass(), llvm::initializeAMDGPUPreloadKernelArgumentsLegacyPass(), llvm::initializeAMDGPUPrepareAGPRAllocLegacyPass(), llvm::initializeAMDGPUPrintfRuntimeBindingPass(), llvm::initializeAMDGPUPromoteAllocaPass(), llvm::initializeAMDGPUPromoteKernelArgumentsPass(), llvm::initializeAMDGPURegBankCombinerLegacyPass(), llvm::initializeAMDGPURegBankLegalizeLegacyPass(), llvm::initializeAMDGPURegBankSelectLegacyPass(), llvm::initializeAMDGPURemoveIncompatibleFunctionsLegacyPass(), llvm::initializeAMDGPUReserveWWMRegsLegacyPass(), llvm::initializeAMDGPUResourceUsageAnalysisWrapperPassPass(), llvm::initializeAMDGPURewriteAGPRCopyMFMALegacyPass(), llvm::initializeAMDGPURewriteOutArgumentsPass(), llvm::initializeAMDGPURewriteUndefForPHILegacyPass(), llvm::initializeAMDGPUSwLowerLDSLegacyPass(), llvm::initializeAMDGPUUniformIntrinsicCombineLegacyPass(), llvm::initializeAMDGPUUnifyDivergentExitNodesLegacyPass(), llvm::initializeAMDGPUWaitSGPRHazardsLegacyPass(), llvm::initializeGCNCreateVOPDLegacyPass(), llvm::initializeGCNDPPCombineLegacyPass(), llvm::initializeGCNNSAReassignLegacyPass(), llvm::initializeGCNPreRALongBranchRegLegacyPass(), llvm::initializeGCNPreRAOptimizationsLegacyPass(), llvm::initializeGCNRegPressurePrinterPass(), llvm::initializeGCNRewritePartialRegUsesLegacyPass(), llvm::initializeGlobalISel(), llvm::initializeR600ClauseMergePassPass(), llvm::initializeR600ControlFlowFinalizerPass(), llvm::initializeR600EmitClauseMarkersPass(), llvm::initializeR600ExpandSpecialInstrsPassPass(), llvm::initializeR600MachineCFGStructurizerPass(), llvm::initializeR600PacketizerPass(), llvm::initializeR600VectorRegMergerPass(), llvm::initializeSIAnnotateControlFlowLegacyPass(), llvm::initializeSIFixSGPRCopiesLegacyPass(), llvm::initializeSIFixVGPRCopiesLegacyPass(), llvm::initializeSIFoldOperandsLegacyPass(), llvm::initializeSIFormMemoryClausesLegacyPass(), llvm::initializeSIInsertAsyncBarrierArriveWorkaroundLegacyPass(), llvm::initializeSIInsertHardClausesLegacyPass(), llvm::initializeSIInsertWaitcntsLegacyPass(), llvm::initializeSILateBranchLoweringLegacyPass(), llvm::initializeSILoadStoreOptimizerLegacyPass(), llvm::initializeSILowerControlFlowLegacyPass(), llvm::initializeSILowerI1CopiesLegacyPass(), llvm::initializeSILowerSGPRSpillsLegacyPass(), llvm::initializeSILowerWWMCopiesLegacyPass(), llvm::initializeSIMemoryLegalizerLegacyPass(), llvm::initializeSIModeRegisterLegacyPass(), llvm::initializeSIOptimizeExecMaskingLegacyPass(), llvm::initializeSIOptimizeExecMaskingPreRALegacyPass(), llvm::initializeSIOptimizeVGPRLiveRangeLegacyPass(), llvm::initializeSIPeepholeSDWALegacyPass(), llvm::initializeSIPostRA16BitMovFoldingLegacyPass(), llvm::initializeSIPostRABundlerLegacyPass(), llvm::initializeSIPreAllocateWWMRegsLegacyPass(), llvm::initializeSIPreEmitPeepholeLegacyPass(), llvm::initializeSIShrinkInstructionsLegacyPass(), llvm::initializeSIWholeQuadModeLegacyPass(), LLVM_ABI, LLVM_EXTERNAL_VISIBILITY, X, and Y.

◆ mayNeedAsyncBarrierArriveWorkaround()

bool mayNeedAsyncBarrierArriveWorkaround ( const Triple & TT)
static

◆ mustPreserveGV()

◆ onlyAllocateSGPRs()

◆ onlyAllocateVGPRs()

◆ onlyAllocateWWMRegs()

◆ parseAMDGPUAtomicOptimizerStrategy()

◆ parseAMDGPUAttributorPassOptions()

◆ useDefaultRegisterAllocator()

FunctionPass * useDefaultRegisterAllocator ( )
static

-{sgpr|wwm|vgpr}-regalloc=... command line option.

Definition at line 252 of file AMDGPUTargetMachine.cpp.

◆ useNoopPostScheduler()

bool useNoopPostScheduler ( const AMDGPUOptions & CLOpts,
const Function & F )
static

Variable Documentation

◆ EnableLowerModuleLDS

cl::opt< bool, true > EnableLowerModuleLDS("amdgpu-enable-lower-module-lds", cl::desc("Enable lower module lds pass"), cl::location(AMDGPUTargetMachine::EnableLowerModuleLDS), cl::init(true), cl::Hidden) ( "amdgpu-enable-lower-module-lds" ,
cl::desc("Enable lower module lds pass") ,
cl::location(AMDGPUTargetMachine::EnableLowerModuleLDS) ,
cl::init(true) ,
cl::Hidden  )
static

◆ EnableObjectLinking

cl::opt< bool, true > EnableObjectLinking("amdgpu-enable-object-linking", cl::desc("Enable object linking for cross-TU LDS and ABI support"), cl::location(AMDGPUTargetMachine::EnableObjectLinking), cl::init(false), cl::Hidden) ( "amdgpu-enable-object-linking" ,
cl::desc("Enable object linking for cross-TU LDS and ABI support") ,
cl::location(AMDGPUTargetMachine::EnableObjectLinking) ,
cl::init(false) ,
cl::Hidden  )
static

◆ GCNILPSchedRegistry

MachineSchedRegistry GCNILPSchedRegistry("gcn-iterative-ilp", "Run GCN iterative scheduler for ILP scheduling (experimental)", createIterativeILPMachineScheduler) ( "gcn-iterative-ilp" ,
"Run GCN iterative scheduler for ILP scheduling (experimental)" ,
createIterativeILPMachineScheduler  )
static

◆ GCNMaxILPSchedRegistry

MachineSchedRegistry GCNMaxILPSchedRegistry("gcn-max-ilp", "Run GCN scheduler to maximize ilp", createGCNMaxILPMachineScheduler) ( "gcn-max-ilp" ,
"Run GCN scheduler to maximize ilp" ,
createGCNMaxILPMachineScheduler  )
static

◆ GCNMaxMemoryClauseSchedRegistry

MachineSchedRegistry GCNMaxMemoryClauseSchedRegistry("gcn-max-memory-clause", "Run GCN scheduler to maximize memory clause", createGCNMaxMemoryClauseMachineScheduler) ( "gcn-max-memory-clause" ,
"Run GCN scheduler to maximize memory clause" ,
createGCNMaxMemoryClauseMachineScheduler  )
static

◆ GCNMaxOccupancySchedRegistry

MachineSchedRegistry GCNMaxOccupancySchedRegistry("gcn-max-occupancy", "Run GCN scheduler to maximize occupancy", createGCNMaxOccupancyMachineScheduler) ( "gcn-max-occupancy" ,
"Run GCN scheduler to maximize occupancy" ,
createGCNMaxOccupancyMachineScheduler  )
static

◆ GCNMinRegSchedRegistry

MachineSchedRegistry GCNMinRegSchedRegistry("gcn-iterative-minreg", "Run GCN iterative scheduler for minimal register usage (experimental)", createMinRegScheduler) ( "gcn-iterative-minreg" ,
"Run GCN iterative scheduler for minimal register usage (experimental)" ,
createMinRegScheduler  )
static

◆ InitializeDefaultSGPRRegisterAllocatorFlag

llvm::once_flag InitializeDefaultSGPRRegisterAllocatorFlag
static

A dummy default pass factory indicates whether the register allocator is overridden on the command line.

Definition at line 256 of file AMDGPUTargetMachine.cpp.

◆ InitializeDefaultVGPRRegisterAllocatorFlag

llvm::once_flag InitializeDefaultVGPRRegisterAllocatorFlag
static

Definition at line 257 of file AMDGPUTargetMachine.cpp.

◆ InitializeDefaultWWMRegisterAllocatorFlag

llvm::once_flag InitializeDefaultWWMRegisterAllocatorFlag
static

Definition at line 258 of file AMDGPUTargetMachine.cpp.

◆ IterativeGCNMaxOccupancySchedRegistry

MachineSchedRegistry IterativeGCNMaxOccupancySchedRegistry("gcn-iterative-max-occupancy-experimental", "Run GCN scheduler to maximize occupancy (experimental)", createIterativeGCNMaxOccupancyMachineScheduler) ( "gcn-iterative-max-occupancy-experimental" ,
"Run GCN scheduler to maximize occupancy (experimental)" ,
createIterativeGCNMaxOccupancyMachineScheduler  )
static

◆ RegAllocOptNotSupportedMessage

const char RegAllocOptNotSupportedMessage[]
static
Initial value:
=
"-regalloc not supported with amdgcn. Use -sgpr-regalloc, -wwm-regalloc, "
"and -vgpr-regalloc"

Definition at line 1753 of file AMDGPUTargetMachine.cpp.

◆ SGPRRegAlloc

cl::opt< SGPRRegisterRegAlloc::FunctionPassCtor, false, RegisterPassParser< SGPRRegisterRegAlloc > > SGPRRegAlloc("sgpr-regalloc", cl::Hidden, cl::init(&useDefaultRegisterAllocator), cl::desc("Register allocator to use for SGPRs")) ( "sgpr-regalloc" ,
cl::Hidden ,
cl::init & useDefaultRegisterAllocator,
cl::desc("Register allocator to use for SGPRs")  )
static

◆ SGPRRegAllocNPM

cl::opt< RegAllocType, false, RegAllocTypeParser > SGPRRegAllocNPM("sgpr-regalloc-npm", cl::Hidden, cl::init(RegAllocType::Default), cl::desc("Register allocator for SGPRs (new pass manager)")) ( "sgpr-regalloc-npm" ,
cl::Hidden ,
cl::init(RegAllocType::Default) ,
cl::desc("Register allocator for SGPRs (new pass manager)")  )
static

◆ SISchedRegistry

MachineSchedRegistry SISchedRegistry("si", "Run SI's custom scheduler", createSIMachineScheduler) ( "si" ,
"Run SI's custom scheduler" ,
createSIMachineScheduler  )
static

◆ VGPRRegAlloc

cl::opt< VGPRRegisterRegAlloc::FunctionPassCtor, false, RegisterPassParser< VGPRRegisterRegAlloc > > VGPRRegAlloc("vgpr-regalloc", cl::Hidden, cl::init(&useDefaultRegisterAllocator), cl::desc("Register allocator to use for VGPRs")) ( "vgpr-regalloc" ,
cl::Hidden ,
cl::init & useDefaultRegisterAllocator,
cl::desc("Register allocator to use for VGPRs")  )
static

◆ VGPRRegAllocNPM

cl::opt< RegAllocType, false, RegAllocTypeParser > VGPRRegAllocNPM("vgpr-regalloc-npm", cl::Hidden, cl::init(RegAllocType::Default), cl::desc("Register allocator for VGPRs (new pass manager)")) ( "vgpr-regalloc-npm" ,
cl::Hidden ,
cl::init(RegAllocType::Default) ,
cl::desc("Register allocator for VGPRs (new pass manager)")  )
static

◆ WWMRegAlloc

cl::opt< WWMRegisterRegAlloc::FunctionPassCtor, false, RegisterPassParser< WWMRegisterRegAlloc > > WWMRegAlloc("wwm-regalloc", cl::Hidden, cl::init(&useDefaultRegisterAllocator), cl::desc("Register allocator to use for WWM registers")) ( "wwm-regalloc" ,
cl::Hidden ,
cl::init & useDefaultRegisterAllocator,
cl::desc("Register allocator to use for WWM registers")  )
static

◆ WWMRegAllocNPM

cl::opt< RegAllocType, false, RegAllocTypeParser > WWMRegAllocNPM("wwm-regalloc-npm", cl::Hidden, cl::init(RegAllocType::Default), cl::desc("Register allocator for WWM registers (new pass manager)")) ( "wwm-regalloc-npm" ,
cl::Hidden ,
cl::init(RegAllocType::Default) ,
cl::desc("Register allocator for WWM registers (new pass manager)")  )
static