29#define DEBUG_TYPE "amdgpu-export-kernel-runtime-handles"
36class AMDGPUExportKernelRuntimeHandlesLegacy :
public ModulePass {
40 explicit AMDGPUExportKernelRuntimeHandlesLegacy() :
ModulePass(
ID) {}
48char AMDGPUExportKernelRuntimeHandlesLegacy::ID = 0;
51 AMDGPUExportKernelRuntimeHandlesLegacy::ID;
54 "Externalize enqueued block runtime handles",
false,
false)
57 return new AMDGPUExportKernelRuntimeHandlesLegacy();
63 const StringLiteral HandleSectionName(
".amdgpu.kernel.runtime.handle");
66 if (GV.getSection() == HandleSectionName) {
68 GV.setDSOLocal(
false);
82 const MDNode *Associated =
F.getMetadata(LLVMContext::MD_associated);
86 auto *VM = cast<ValueAsMetadata>(Associated->
getOperand(0));
87 auto *Handle = dyn_cast<GlobalObject>(VM->getValue());
88 if (Handle && Handle->getSection() == HandleSectionName) {
97bool AMDGPUExportKernelRuntimeHandlesLegacy::runOnModule(
Module &M) {
static bool exportKernelRuntimeHandles(Module &M)
Module.h This file contains the declarations for the Module class.
ModuleAnalysisManager MAM
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM)
This templated class represents "all analyses that operate over <a particular IR unit>" (e....
A container for analyses that lazily runs them and caches their results.
@ ProtectedVisibility
The GV is protected.
@ ExternalLinkage
Externally visible function.
const MDOperand & getOperand(unsigned I) const
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
virtual bool runOnModule(Module &M)=0
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
A Module instance is used to store all the information related to an LLVM module.
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
PreservedAnalyses & preserveSet()
Mark an analysis set as preserved.
A wrapper around a string literal that serves as a proxy for constructing global tables of StringRefs...
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ AMDGPU_KERNEL
Used for AMDGPU code object kernels.
This is an optimization pass for GlobalISel generic memory operations.
char & AMDGPUExportKernelRuntimeHandlesLegacyID
ModulePass * createAMDGPUExportKernelRuntimeHandlesLegacyPass()