[clang] [llvm] [clang][CodeGen] Global constructors/destructors are globals (PR #93914)

Alex Voicu via cfe-commits cfe-commits at lists.llvm.org
Fri May 31 05:39:25 PDT 2024


AlexVlx wrote:

> llvm datalayout defines
> 
> P - program addr space for functions G - global addr space for global variables
> 
> https://llvm.org/docs/LangRef.html#langref-datalayout
> 
> should we use P for llvm.global_ctors instead of G?



> llvm datalayout defines
> 
> P - program addr space for functions G - global addr space for global variables
> 
> https://llvm.org/docs/LangRef.html#langref-datalayout
> 
> should we use P for llvm.global_ctors instead of G?



> llvm datalayout defines
> 
> P - program addr space for functions G - global addr space for global variables
> 
> https://llvm.org/docs/LangRef.html#langref-datalayout
> 
> should we use P for llvm.global_ctors instead of G?

I'm not sure we can do that for anything but the ctor function (where it's already used), since, per langref, the third element can be either a global or a function, and whilst all functions are globals not all globals are functions (the distinction is arbitrary for many targets and, as @jrtc27 says, it's just lifetime ensuring hook, but we should probably stick with doing what we claim to do in the public documents).

https://github.com/llvm/llvm-project/pull/93914


More information about the cfe-commits mailing list