Skip to content

Commit cb92520

Browse files
committed
LLVMJIT: LLVMGetHostCPUFeatures now is upstream, use LLMV version if available.
Noticed thanks to buildfarm animal seawasp. Author: Andres Freund Backpatch: v11-, where LLVM based JIT compliation was introduced.
1 parent b0c5da6 commit cb92520

File tree

6 files changed

+24
-1
lines changed

6 files changed

+24
-1
lines changed

config/llvm.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ AC_DEFUN([PGAC_LLVM_SUPPORT],
9595
SAVE_CPPFLAGS="$CPPFLAGS"
9696
CPPFLAGS="$CPPFLAGS $LLVM_CPPFLAGS"
9797
AC_CHECK_DECLS([LLVMOrcGetSymbolAddressIn], [], [], [[#include <llvm-c/OrcBindings.h>]])
98-
AC_CHECK_DECLS([LLVMGetHostCPUName], [], [], [[#include <llvm-c/TargetMachine.h>]])
98+
AC_CHECK_DECLS([LLVMGetHostCPUName, LLVMGetHostCPUFeatures], [], [], [[#include <llvm-c/TargetMachine.h>]])
9999
AC_CHECK_DECLS([LLVMCreateGDBRegistrationListener, LLVMCreatePerfJITEventListener], [], [], [[#include <llvm-c/ExecutionEngine.h>]])
100100
CPPFLAGS="$SAVE_CPPFLAGS"
101101

configure

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5203,6 +5203,17 @@ fi
52035203

52045204
cat >>confdefs.h <<_ACEOF
52055205
#define HAVE_DECL_LLVMGETHOSTCPUNAME $ac_have_decl
5206+
_ACEOF
5207+
ac_fn_c_check_decl "$LINENO" "LLVMGetHostCPUFeatures" "ac_cv_have_decl_LLVMGetHostCPUFeatures" "#include <llvm-c/TargetMachine.h>
5208+
"
5209+
if test "x$ac_cv_have_decl_LLVMGetHostCPUFeatures" = xyes; then :
5210+
ac_have_decl=1
5211+
else
5212+
ac_have_decl=0
5213+
fi
5214+
5215+
cat >>confdefs.h <<_ACEOF
5216+
#define HAVE_DECL_LLVMGETHOSTCPUFEATURES $ac_have_decl
52065217
_ACEOF
52075218

52085219
ac_fn_c_check_decl "$LINENO" "LLVMCreateGDBRegistrationListener" "ac_cv_have_decl_LLVMCreateGDBRegistrationListener" "#include <llvm-c/ExecutionEngine.h>

src/backend/jit/llvm/llvmjit_wrap.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ char *LLVMGetHostCPUName(void) {
3232
#endif
3333

3434

35+
#if defined(HAVE_DECL_LLVMGETHOSTCPUFEATURES) && !HAVE_DECL_LLVMGETHOSTCPUFEATURES
3536
char *LLVMGetHostCPUFeatures(void) {
3637
llvm::SubtargetFeatures Features;
3738
llvm::StringMap<bool> HostFeatures;
@@ -42,3 +43,4 @@ char *LLVMGetHostCPUFeatures(void) {
4243

4344
return strdup(Features.getString().c_str());
4445
}
46+
#endif

src/include/jit/llvmjit.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,11 @@ extern LLVMValueRef slot_compile_deform(struct LLVMJitContext *context, TupleDes
125125
extern char *LLVMGetHostCPUName(void);
126126
#endif
127127

128+
#if defined(HAVE_DECL_LLVMGETHOSTCPUFEATURES) && !HAVE_DECL_LLVMGETHOSTCPUFEATURES
128129
/** Get the host CPU features as a string. The result needs to be disposed
129130
with LLVMDisposeMessage. */
130131
extern char *LLVMGetHostCPUFeatures(void);
132+
#endif
131133

132134
#ifdef __cplusplus
133135
} /* extern "C" */

src/include/pg_config.h.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@
142142
`LLVMCreatePerfJITEventListener', and to 0 if you don't. */
143143
#undef HAVE_DECL_LLVMCREATEPERFJITEVENTLISTENER
144144

145+
/* Define to 1 if you have the declaration of `LLVMGetHostCPUFeatures', and to
146+
0 if you don't. */
147+
#undef HAVE_DECL_LLVMGETHOSTCPUFEATURES
148+
145149
/* Define to 1 if you have the declaration of `LLVMGetHostCPUName', and to 0
146150
if you don't. */
147151
#undef HAVE_DECL_LLVMGETHOSTCPUNAME

src/include/pg_config.h.win32

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@
119119
if you don't. */
120120
#define HAVE_DECL_LLVMGETHOSTCPUNAME 0
121121

122+
/* Define to 1 if you have the declaration of `LLVMGetHostCPUFeatures', and to 0
123+
if you don't. */
124+
#define HAVE_DECL_LLVMGETHOSTCPUFEATURES 0
125+
122126
/* Define to 1 if you have the declaration of `LLVMOrcGetSymbolAddressIn', and
123127
to 0 if you don't. */
124128
#define HAVE_DECL_LLVMORCGETSYMBOLADDRESSIN 0

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy