diff options
author | Thomas Munro <tmunro@postgresql.org> | 2023-10-19 03:01:55 +1300 |
---|---|---|
committer | Thomas Munro <tmunro@postgresql.org> | 2023-10-19 03:07:18 +1300 |
commit | 60596f148a661e0fd1d7c1f13a72b55124511e3a (patch) | |
tree | f1092641136ea7d4024a9fab0b5168c99d0dd430 /src | |
parent | 74d19ec096dfbda5782e62892de7e86a104f8265 (diff) | |
download | postgresql-60596f148a661e0fd1d7c1f13a72b55124511e3a.tar.gz postgresql-60596f148a661e0fd1d7c1f13a72b55124511e3a.zip |
jit: Supply LLVMGlobalGetValueType() for LLVM < 8.
Commit 37d5babb used this C API function while adding support for LLVM
16 and opaque pointers, but it's not available in LLVM 7 and older.
Provide it in our own llvmjit_wrap.cpp. It just calls a C++ function
that pre-dates LLVM 3.9, our minimum target.
Back-patch to 12, like 37d5babb.
Discussion: https://postgr.es/m/CA%2BhUKGKnLnJnWrkr%3D4mSGhE5FuTK55FY15uULR7%3Dzzc%3DwX4Nqw%40mail.gmail.com
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/jit/llvm/llvmjit_wrap.cpp | 8 | ||||
-rw-r--r-- | src/include/jit/llvmjit.h | 4 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/backend/jit/llvm/llvmjit_wrap.cpp b/src/backend/jit/llvm/llvmjit_wrap.cpp index 997a2c02789..cb896e2b6a5 100644 --- a/src/backend/jit/llvm/llvmjit_wrap.cpp +++ b/src/backend/jit/llvm/llvmjit_wrap.cpp @@ -88,3 +88,11 @@ LLVMGetFunctionType(LLVMValueRef r) { return llvm::wrap(llvm::unwrap<llvm::Function>(r)->getFunctionType()); } + +#if LLVM_VERSION_MAJOR < 8 +LLVMTypeRef +LLVMGlobalGetValueType(LLVMValueRef g) +{ + return llvm::wrap(llvm::unwrap<llvm::GlobalValue>(g)->getValueType()); +} +#endif diff --git a/src/include/jit/llvmjit.h b/src/include/jit/llvmjit.h index e7f34fa92a9..d7232167e85 100644 --- a/src/include/jit/llvmjit.h +++ b/src/include/jit/llvmjit.h @@ -141,6 +141,10 @@ extern unsigned LLVMGetAttributeCountAtIndexPG(LLVMValueRef F, uint32 Idx); extern LLVMTypeRef LLVMGetFunctionReturnType(LLVMValueRef r); extern LLVMTypeRef LLVMGetFunctionType(LLVMValueRef r); +#if LLVM_MAJOR_VERSION < 8 +extern LLVMTypeRef LLVMGlobalGetValueType(LLVMValueRef g); +#endif + #ifdef __cplusplus } /* extern "C" */ #endif |