[PATCH] D133518: [HLSL] Call global destructors from entries

Chris Bieneman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 8 13:10:56 PDT 2022


beanz created this revision.
beanz added reviewers: aaron.ballman, bogner, python3kgae, pow2clk, tex3d, eli.friedman.
Herald added a subscriber: Anastasia.
Herald added a project: All.
beanz requested review of this revision.
Herald added a project: clang.

HLSL doesn't have a C++ runtime that supports `atexit` registration. To
enable global destructors we instead rely on the `llvm.global_dtor`
mechanism.

This change disables `atexit` generation for HLSL and updates the HLSL
code generation to call global destructors on the exit from entry
functions.

Depends on D132977 <https://reviews.llvm.org/D132977>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133518

Files:
  clang/docs/HLSL/EntryFunctions.rst
  clang/lib/CodeGen/CGHLSLRuntime.cpp
  clang/lib/CodeGen/CGHLSLRuntime.h
  clang/lib/CodeGen/MicrosoftCXXABI.cpp
  clang/test/CodeGenHLSL/GlobalConstructorFunction.hlsl
  clang/test/CodeGenHLSL/GlobalDestructors.hlsl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133518.458837.patch
Type: text/x-patch
Size: 6163 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220908/68ed9976/attachment.bin>


More information about the cfe-commits mailing list