numba / llvmlite

A lightweight LLVM python binding for writing JIT compilers
https://llvmlite.pydata.org/
BSD 2-Clause "Simplified" License
1.94k stars 322 forks source link

[llvmlite] Support opaque pointers. #908

Closed folded closed 1 week ago

folded commented 1 year ago

Fix for issue #900

LLVM 14 introduces optional opaque pointers. If opaque pointers are enabled then there is no way to determine the pointee type. LLVM 16 makes this the default.

In llvmlite and numba this is used to determine ABI size and alignment of types by creating a global variable and then asking for its pointee type in order to get a TypeRef. For global variables specifically this can be shortcut via gv->getValueType(), and doing so removes the current issues when opaque pointers are enabled.

This change has been tested with LLVM 11-14 and so also includes some other changes required to make llvmlite compile on those versions.

dlee992 commented 6 months ago

For a record: I guess this PR could be surpassed by #1042?

gmarkall commented 6 months ago

For a record: I guess this PR could be surpassed by #1042?

Maybe technically, but we won't be able to merge #1042 because it contains the whole LLVM 17 transition in one go, and we need to adopt a more gradual strategy.

dlee992 commented 6 months ago

Yeah, totally understandable.

gmarkall commented 1 week ago

Opaque pointers were implemented in #1064 - closing.

Many thanks for this initial work / reference, @folded !