0001-Supply-missing-LLVMGlobalGetValueType-for-LLVM-8.patch
application/octet-stream
Filename: 0001-Supply-missing-LLVMGlobalGetValueType-for-LLVM-8.patch
Type: application/octet-stream
Part: 0
Message:
Re: LLVM 16 (opaque pointers)
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch 0001
Subject: Supply missing LLVMGlobalGetValueType() for LLVM < 8.
| File | + | − |
|---|---|---|
| src/backend/jit/llvm/llvmjit_wrap.cpp | 8 | 0 |
| src/include/jit/llvmjit.h | 4 | 0 |
From 69effaf33a733ebf330281837679cb82e45fc1db Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@gmail.com>
Date: Thu, 19 Oct 2023 00:24:02 +1300
Subject: [PATCH] Supply missing LLVMGlobalGetValueType() for LLVM < 8.
Commit 37d5babb started using this C function while adding support for
LLVM 16, but failed to notice that it was not available in old LLVM
versions. We can put the wrapper into our own llvmjit_wrap.cpp file.
Discussion: https://postgr.es/m/CA%2BhUKGKnLnJnWrkr%3D4mSGhE5FuTK55FY15uULR7%3Dzzc%3DwX4Nqw%40mail.gmail.com
---
src/backend/jit/llvm/llvmjit_wrap.cpp | 8 ++++++++
src/include/jit/llvmjit.h | 4 ++++
2 files changed, 12 insertions(+)
diff --git a/src/backend/jit/llvm/llvmjit_wrap.cpp b/src/backend/jit/llvm/llvmjit_wrap.cpp
index 997a2c0278..cb896e2b6a 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 8eed61373b..3ab86de3ac 100644
--- a/src/include/jit/llvmjit.h
+++ b/src/include/jit/llvmjit.h
@@ -146,6 +146,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
--
2.42.0