Skip to content

Commit f90b4a8

Browse files
committed
jit: Supply LLVMGlobalGetValueType() for LLVM < 8.
Commit 37d5bab 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 37d5bab. Discussion: https://postgr.es/m/CA%2BhUKGKnLnJnWrkr%3D4mSGhE5FuTK55FY15uULR7%3Dzzc%3DwX4Nqw%40mail.gmail.com
1 parent 37d5bab commit f90b4a8

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/backend/jit/llvm/llvmjit_wrap.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,11 @@ LLVMGetFunctionType(LLVMValueRef r)
8888
{
8989
return llvm::wrap(llvm::unwrap<llvm::Function>(r)->getFunctionType());
9090
}
91+
92+
#if LLVM_VERSION_MAJOR < 8
93+
LLVMTypeRef
94+
LLVMGlobalGetValueType(LLVMValueRef g)
95+
{
96+
return llvm::wrap(llvm::unwrap<llvm::GlobalValue>(g)->getValueType());
97+
}
98+
#endif

src/include/jit/llvmjit.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ extern unsigned LLVMGetAttributeCountAtIndexPG(LLVMValueRef F, uint32 Idx);
146146
extern LLVMTypeRef LLVMGetFunctionReturnType(LLVMValueRef r);
147147
extern LLVMTypeRef LLVMGetFunctionType(LLVMValueRef r);
148148

149+
#if LLVM_MAJOR_VERSION < 8
150+
extern LLVMTypeRef LLVMGlobalGetValueType(LLVMValueRef g);
151+
#endif
152+
149153
#ifdef __cplusplus
150154
} /* extern "C" */
151155
#endif

0 commit comments

Comments
 (0)