TYnptr in LLVM?

kinke kinke at libero.it
Mon Jul 16 09:29:59 UTC 2018


On Monday, 16 July 2018 at 06:38:01 UTC, Jacob Carlborg wrote:
> The TYnptr type in DMD [1], what is the corresponding type, in 
> LLVM? I'm referring to a instance of `llvm::Type` [2] that can 
> be used in global variable, `llvm::GlobalVarible`.
>
> [1] 
> https://github.com/dlang/dmd/blob/master/src/dmd/backend/ty.d#L66
> [2] http://llvm.org/doxygen/classllvm_1_1Type.html
>
> --
> /Jacob Carlborg

No idea about the DMD backend, but in LLVM you generally just 
declare a global of some arbitrary IR type (e.g., from a D type: 
`DtoType(dtype)`), and the resulting GlobalVariable will always 
be a pointer to that type. You define the global by setting an 
initializer. See the pretty new `{declare,define}Global()` 
helpers.


More information about the digitalmars-d-ldc mailing list