Commit cb925205 authored by Andres Freund's avatar Andres Freund

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.
parent b0c5da61
...@@ -95,7 +95,7 @@ AC_DEFUN([PGAC_LLVM_SUPPORT], ...@@ -95,7 +95,7 @@ AC_DEFUN([PGAC_LLVM_SUPPORT],
SAVE_CPPFLAGS="$CPPFLAGS" SAVE_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $LLVM_CPPFLAGS" CPPFLAGS="$CPPFLAGS $LLVM_CPPFLAGS"
AC_CHECK_DECLS([LLVMOrcGetSymbolAddressIn], [], [], [[#include <llvm-c/OrcBindings.h>]]) AC_CHECK_DECLS([LLVMOrcGetSymbolAddressIn], [], [], [[#include <llvm-c/OrcBindings.h>]])
AC_CHECK_DECLS([LLVMGetHostCPUName], [], [], [[#include <llvm-c/TargetMachine.h>]]) AC_CHECK_DECLS([LLVMGetHostCPUName, LLVMGetHostCPUFeatures], [], [], [[#include <llvm-c/TargetMachine.h>]])
AC_CHECK_DECLS([LLVMCreateGDBRegistrationListener, LLVMCreatePerfJITEventListener], [], [], [[#include <llvm-c/ExecutionEngine.h>]]) AC_CHECK_DECLS([LLVMCreateGDBRegistrationListener, LLVMCreatePerfJITEventListener], [], [], [[#include <llvm-c/ExecutionEngine.h>]])
CPPFLAGS="$SAVE_CPPFLAGS" CPPFLAGS="$SAVE_CPPFLAGS"
......
...@@ -5203,6 +5203,17 @@ fi ...@@ -5203,6 +5203,17 @@ fi
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_LLVMGETHOSTCPUNAME $ac_have_decl #define HAVE_DECL_LLVMGETHOSTCPUNAME $ac_have_decl
_ACEOF
ac_fn_c_check_decl "$LINENO" "LLVMGetHostCPUFeatures" "ac_cv_have_decl_LLVMGetHostCPUFeatures" "#include <llvm-c/TargetMachine.h>
"
if test "x$ac_cv_have_decl_LLVMGetHostCPUFeatures" = xyes; then :
ac_have_decl=1
else
ac_have_decl=0
fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_LLVMGETHOSTCPUFEATURES $ac_have_decl
_ACEOF _ACEOF
ac_fn_c_check_decl "$LINENO" "LLVMCreateGDBRegistrationListener" "ac_cv_have_decl_LLVMCreateGDBRegistrationListener" "#include <llvm-c/ExecutionEngine.h> ac_fn_c_check_decl "$LINENO" "LLVMCreateGDBRegistrationListener" "ac_cv_have_decl_LLVMCreateGDBRegistrationListener" "#include <llvm-c/ExecutionEngine.h>
......
...@@ -32,6 +32,7 @@ char *LLVMGetHostCPUName(void) { ...@@ -32,6 +32,7 @@ char *LLVMGetHostCPUName(void) {
#endif #endif
#if defined(HAVE_DECL_LLVMGETHOSTCPUFEATURES) && !HAVE_DECL_LLVMGETHOSTCPUFEATURES
char *LLVMGetHostCPUFeatures(void) { char *LLVMGetHostCPUFeatures(void) {
llvm::SubtargetFeatures Features; llvm::SubtargetFeatures Features;
llvm::StringMap<bool> HostFeatures; llvm::StringMap<bool> HostFeatures;
...@@ -42,3 +43,4 @@ char *LLVMGetHostCPUFeatures(void) { ...@@ -42,3 +43,4 @@ char *LLVMGetHostCPUFeatures(void) {
return strdup(Features.getString().c_str()); return strdup(Features.getString().c_str());
} }
#endif
...@@ -125,9 +125,11 @@ extern LLVMValueRef slot_compile_deform(struct LLVMJitContext *context, TupleDes ...@@ -125,9 +125,11 @@ extern LLVMValueRef slot_compile_deform(struct LLVMJitContext *context, TupleDes
extern char *LLVMGetHostCPUName(void); extern char *LLVMGetHostCPUName(void);
#endif #endif
#if defined(HAVE_DECL_LLVMGETHOSTCPUFEATURES) && !HAVE_DECL_LLVMGETHOSTCPUFEATURES
/** Get the host CPU features as a string. The result needs to be disposed /** Get the host CPU features as a string. The result needs to be disposed
with LLVMDisposeMessage. */ with LLVMDisposeMessage. */
extern char *LLVMGetHostCPUFeatures(void); extern char *LLVMGetHostCPUFeatures(void);
#endif
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */
......
...@@ -142,6 +142,10 @@ ...@@ -142,6 +142,10 @@
`LLVMCreatePerfJITEventListener', and to 0 if you don't. */ `LLVMCreatePerfJITEventListener', and to 0 if you don't. */
#undef HAVE_DECL_LLVMCREATEPERFJITEVENTLISTENER #undef HAVE_DECL_LLVMCREATEPERFJITEVENTLISTENER
/* Define to 1 if you have the declaration of `LLVMGetHostCPUFeatures', and to
0 if you don't. */
#undef HAVE_DECL_LLVMGETHOSTCPUFEATURES
/* Define to 1 if you have the declaration of `LLVMGetHostCPUName', and to 0 /* Define to 1 if you have the declaration of `LLVMGetHostCPUName', and to 0
if you don't. */ if you don't. */
#undef HAVE_DECL_LLVMGETHOSTCPUNAME #undef HAVE_DECL_LLVMGETHOSTCPUNAME
......
...@@ -119,6 +119,10 @@ ...@@ -119,6 +119,10 @@
if you don't. */ if you don't. */
#define HAVE_DECL_LLVMGETHOSTCPUNAME 0 #define HAVE_DECL_LLVMGETHOSTCPUNAME 0
/* Define to 1 if you have the declaration of `LLVMGetHostCPUFeatures', and to 0
if you don't. */
#define HAVE_DECL_LLVMGETHOSTCPUFEATURES 0
/* Define to 1 if you have the declaration of `LLVMOrcGetSymbolAddressIn', and /* Define to 1 if you have the declaration of `LLVMOrcGetSymbolAddressIn', and
to 0 if you don't. */ to 0 if you don't. */
#define HAVE_DECL_LLVMORCGETSYMBOLADDRESSIN 0 #define HAVE_DECL_LLVMORCGETSYMBOLADDRESSIN 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment