Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
LLVMJIT: LLVMGetHostCPUFeatures now is upstream, use LLMV version if available.
authorAndres Freund <andres@anarazel.de>
Fri, 24 Aug 2018 17:20:55 +0000 (10:20 -0700)
committerAndres Freund <andres@anarazel.de>
Fri, 24 Aug 2018 17:21:48 +0000 (10:21 -0700)
Noticed thanks to buildfarm animal seawasp.

Author: Andres Freund
Backpatch: v11-, where LLVM based JIT compliation was introduced.

config/llvm.m4
configure
src/backend/jit/llvm/llvmjit_wrap.cpp
src/include/jit/llvmjit.h
src/include/pg_config.h.in
src/include/pg_config.h.win32

index 09ff6812280bedab419daee93d74ebab3b6bf322..7d81ac0b99763c51b7b90349f95d7f11dadf2798 100644 (file)
@@ -95,7 +95,7 @@ AC_DEFUN([PGAC_LLVM_SUPPORT],
   SAVE_CPPFLAGS="$CPPFLAGS"
   CPPFLAGS="$CPPFLAGS $LLVM_CPPFLAGS"
   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>]])
   CPPFLAGS="$SAVE_CPPFLAGS"
 
index 54d8994c7aafde078ccdfa310c94ff9b139935ff..1f31d794553d11f01092bd17c8ccb6b8220a48f5 100755 (executable)
--- a/configure
+++ b/configure
@@ -5019,6 +5019,17 @@ fi
 
 cat >>confdefs.h <<_ACEOF
 #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
 
   ac_fn_c_check_decl "$LINENO" "LLVMCreateGDBRegistrationListener" "ac_cv_have_decl_LLVMCreateGDBRegistrationListener" "#include <llvm-c/ExecutionEngine.h>
index 5d1a17cde042aa711d230255e88d92c65cf364f6..4d0c3f680ff59b6bb0da140538db1b612b1d1c4d 100644 (file)
@@ -32,6 +32,7 @@ char *LLVMGetHostCPUName(void) {
 #endif
 
 
+#if defined(HAVE_DECL_LLVMGETHOSTCPUFEATURES) && !HAVE_DECL_LLVMGETHOSTCPUFEATURES
 char *LLVMGetHostCPUFeatures(void) {
    llvm::SubtargetFeatures Features;
    llvm::StringMap<bool> HostFeatures;
@@ -42,3 +43,4 @@ char *LLVMGetHostCPUFeatures(void) {
 
    return strdup(Features.getString().c_str());
 }
+#endif
index b0093db49d76c6ea2f57f63e8745c71ab47dec27..c81cff8a35f2bec8cc4adf13482634f084343543 100644 (file)
@@ -125,9 +125,11 @@ extern LLVMValueRef slot_compile_deform(struct LLVMJitContext *context, TupleDes
 extern char *LLVMGetHostCPUName(void);
 #endif
 
+#if defined(HAVE_DECL_LLVMGETHOSTCPUFEATURES) && !HAVE_DECL_LLVMGETHOSTCPUFEATURES
 /** Get the host CPU features as a string. The result needs to be disposed
   with LLVMDisposeMessage. */
 extern char *LLVMGetHostCPUFeatures(void);
+#endif
 
 #ifdef __cplusplus
 } /* extern "C" */
index 32535fb54cbfa192714e9d994f038715c1d48457..be9d5647c1e5db2575ee7184cce962531349b042 100644 (file)
    `LLVMCreatePerfJITEventListener', and to 0 if you don't. */
 #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
    if you don't. */
 #undef HAVE_DECL_LLVMGETHOSTCPUNAME
index 082f3c16079c6eeeb073f2bc2c81857936e14a8b..0c505d67e0daa0bf23b32dfd3d2f1e8df79218e1 100644 (file)
    if you don't. */
 #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
    to 0 if you don't. */
 #define HAVE_DECL_LLVMORCGETSYMBOLADDRESSIN 0