[PATCH] D133993: [HLSL] Remove global ctor/dtor variable for non-lib profile.

Chris Bieneman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 6 11:25:42 PDT 2022


beanz added a comment.

In D133993#3816526 <https://reviews.llvm.org/D133993#3816526>, @efriedma wrote:

> Why are we using different mechanisms for global constructors in "libraries" vs. other code?  If we need a mechanism in LLVM already, we might as well use it all the time?

To elaborate here in a different wording... You can kinda think of HLSL "library" builds a lot like static archive linking in C/C++, so for the most part library shaders just work like C++.

The non-library mode is _very_ different. For non-library builds there is no linker, we emit fully contained executable code from the backend. In non-library code we need to inline global constructors into the entry function, but we don't need to keep the global variables around because we have no dynamic linker or loader, shader execution is much more similar to baremetal targets in that regard.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133993/new/

https://reviews.llvm.org/D133993



More information about the cfe-commits mailing list