[PATCH] D149451: [NVPTX] Add NVPTXCtorDtorLoweringPass to handle global ctors / dtors
Joseph Huber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 28 08:13:11 PDT 2023
jhuber6 created this revision.
jhuber6 added reviewers: jdoerfert, tra, yaxunl, arsenm, JonChesterfield, sivachandra.
Herald added subscribers: kosarev, mattd, gchakrabarti, asavonic, hiraditya, tpr.
Herald added a project: All.
jhuber6 requested review of this revision.
Herald added subscribers: llvm-commits, wdng, jholewinski.
Herald added a project: LLVM.
This patch mostly adapts the existing AMDGPUCtorDtorLoweringPass for use
by the Nvidia backend. This pass transforms the ctor / dtor list into a
kernel call that can be used to invoke those functinos. Furthermore, we
emit globals such that the names and addresses of these constructor
functions can be found by the driver. Unfortunately, since NVPTX has no
way to emit variables at a named section, nor a functioning linker to
provide the begin / end symbols, we need to mangle these names and have
an external application find them.
This work is related to the work in D149398 <https://reviews.llvm.org/D149398> and D149340 <https://reviews.llvm.org/D149340>.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D149451
Files:
llvm/lib/Target/NVPTX/CMakeLists.txt
llvm/lib/Target/NVPTX/NVPTX.h
llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
llvm/lib/Target/NVPTX/NVPTXCtorDtorLowering.cpp
llvm/lib/Target/NVPTX/NVPTXCtorDtorLowering.h
llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
llvm/test/CodeGen/NVPTX/global-ctor.ll
llvm/test/CodeGen/NVPTX/global-dtor.ll
llvm/test/CodeGen/NVPTX/lower-ctor-dtor.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149451.517928.patch
Type: text/x-patch
Size: 13120 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230428/602502cc/attachment.bin>
More information about the llvm-commits
mailing list