diff options
author | Thomas Munro <tmunro@postgresql.org> | 2023-10-18 22:09:05 +1300 |
---|---|---|
committer | Thomas Munro <tmunro@postgresql.org> | 2023-10-18 22:59:46 +1300 |
commit | eed1feb3fee1a558b67b04cbd709f31142f071d5 (patch) | |
tree | 0a6ce2908f1ba4687fd1502e1a93dfb63520345e /src/include/jit/llvmjit.h | |
parent | c4e561c1e029461430c86d81a1956ddddb4fbe13 (diff) |
jit: Support opaque pointers in LLVM 16.
Remove use of LLVMGetElementType() and provide the type of all pointers
to LLVMBuildXXX() functions when emitting IR, as required by modern LLVM
versions[1].
* For LLVM <= 14, we'll still use the old LLVMBuildXXX() functions.
* For LLVM == 15, we'll continue to do the same, explicitly opting
out of opaque pointer mode.
* For LLVM >= 16, we'll use the new LLVMBuildXXX2() functions that take
the extra type argument.
The difference is hidden behind some new IR emitting wrapper functions
l_load(), l_gep(), l_call() etc. The change is mostly mechanical,
except that at each site the correct type had to be provided.
In some places we needed to do some extra work to get functions types,
including some new wrappers for C++ APIs that are not yet exposed by in
LLVM's C API, and some new "example" functions in llvmjit_types.c
because it's no longer possible to start from the function pointer type
and ask for the function type.
Back-patch to 12, because it's a little tricker in 11 and we agreed not
to put the latest LLVM support into the upcoming final release of 11.
[1] https://llvm.org/docs/OpaquePointers.html
Reviewed-by: Dmitry Dolgov <9erthalion6@gmail.com>
Reviewed-by: Ronan Dunklau <ronan.dunklau@aiven.io>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/CA%2BhUKGKNX_%3Df%2B1C4r06WETKTq0G4Z_7q4L4Fxn5WWpMycDj9Fw%40mail.gmail.com
Diffstat (limited to 'src/include/jit/llvmjit.h')
-rw-r--r-- | src/include/jit/llvmjit.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/include/jit/llvmjit.h b/src/include/jit/llvmjit.h index 4541f9a2c42..89e21d4ae9b 100644 --- a/src/include/jit/llvmjit.h +++ b/src/include/jit/llvmjit.h @@ -67,6 +67,8 @@ extern PGDLLIMPORT LLVMTypeRef TypeStorageBool; extern PGDLLIMPORT LLVMTypeRef StructNullableDatum; extern PGDLLIMPORT LLVMTypeRef StructTupleDescData; extern PGDLLIMPORT LLVMTypeRef StructHeapTupleData; +extern PGDLLIMPORT LLVMTypeRef StructHeapTupleHeaderData; +extern PGDLLIMPORT LLVMTypeRef StructMinimalTupleData; extern PGDLLIMPORT LLVMTypeRef StructTupleTableSlot; extern PGDLLIMPORT LLVMTypeRef StructHeapTupleTableSlot; extern PGDLLIMPORT LLVMTypeRef StructMinimalTupleTableSlot; @@ -78,8 +80,11 @@ extern PGDLLIMPORT LLVMTypeRef StructExprState; extern PGDLLIMPORT LLVMTypeRef StructAggState; extern PGDLLIMPORT LLVMTypeRef StructAggStatePerTransData; extern PGDLLIMPORT LLVMTypeRef StructAggStatePerGroupData; +extern PGDLLIMPORT LLVMTypeRef StructPlanState; extern PGDLLIMPORT LLVMValueRef AttributeTemplate; +extern PGDLLIMPORT LLVMValueRef ExecEvalBoolSubroutineTemplate; +extern PGDLLIMPORT LLVMValueRef ExecEvalSubroutineTemplate; extern void llvm_enter_fatal_on_oom(void); @@ -133,6 +138,8 @@ extern char *LLVMGetHostCPUFeatures(void); #endif extern unsigned LLVMGetAttributeCountAtIndexPG(LLVMValueRef F, uint32 Idx); +extern LLVMTypeRef LLVMGetFunctionReturnType(LLVMValueRef r); +extern LLVMTypeRef LLVMGetFunctionType(LLVMValueRef r); #ifdef __cplusplus } /* extern "C" */ |