mirror of
https://github.com/postgres/postgres.git
synced 2025-11-21 00:42:43 +03:00
jit: Require at least LLVM 10.
Remove support for older LLVM versions. The default on common software distributions will be at least LLVM 10 when PostgreSQL 17 ships. Reviewed-by: Peter Eisentraut <peter@eisentraut.org> Discussion: https://postgr.es/m/CA%2BhUKGLhNs5geZaVNj2EJ79Dx9W8fyWUU3HxcpZy55sMGcY%3DiA%40mail.gmail.com
This commit is contained in:
@@ -34,10 +34,8 @@
|
||||
#include <llvm-c/Transforms/IPO.h>
|
||||
#include <llvm-c/Transforms/PassManagerBuilder.h>
|
||||
#include <llvm-c/Transforms/Scalar.h>
|
||||
#if LLVM_VERSION_MAJOR > 6
|
||||
#include <llvm-c/Transforms/Utils.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "jit/llvmjit.h"
|
||||
#include "jit/llvmjit_emit.h"
|
||||
@@ -381,10 +379,7 @@ llvm_expand_funcname(struct LLVMJitContext *context, const char *basename)
|
||||
void *
|
||||
llvm_get_function(LLVMJitContext *context, const char *funcname)
|
||||
{
|
||||
#if LLVM_VERSION_MAJOR > 11 || \
|
||||
defined(HAVE_DECL_LLVMORCGETSYMBOLADDRESSIN) && HAVE_DECL_LLVMORCGETSYMBOLADDRESSIN
|
||||
ListCell *lc;
|
||||
#endif
|
||||
|
||||
llvm_assert_in_fatal_section();
|
||||
|
||||
@@ -432,7 +427,7 @@ llvm_get_function(LLVMJitContext *context, const char *funcname)
|
||||
if (addr)
|
||||
return (void *) (uintptr_t) addr;
|
||||
}
|
||||
#elif defined(HAVE_DECL_LLVMORCGETSYMBOLADDRESSIN) && HAVE_DECL_LLVMORCGETSYMBOLADDRESSIN
|
||||
#else
|
||||
foreach(lc, context->handles)
|
||||
{
|
||||
LLVMOrcTargetAddress addr;
|
||||
@@ -444,28 +439,6 @@ llvm_get_function(LLVMJitContext *context, const char *funcname)
|
||||
if (addr)
|
||||
return (void *) (uintptr_t) addr;
|
||||
}
|
||||
#elif LLVM_VERSION_MAJOR < 5
|
||||
{
|
||||
LLVMOrcTargetAddress addr;
|
||||
|
||||
if ((addr = LLVMOrcGetSymbolAddress(llvm_opt0_orc, funcname)))
|
||||
return (void *) (uintptr_t) addr;
|
||||
if ((addr = LLVMOrcGetSymbolAddress(llvm_opt3_orc, funcname)))
|
||||
return (void *) (uintptr_t) addr;
|
||||
}
|
||||
#else
|
||||
{
|
||||
LLVMOrcTargetAddress addr;
|
||||
|
||||
if (LLVMOrcGetSymbolAddress(llvm_opt0_orc, &addr, funcname))
|
||||
elog(ERROR, "failed to look up symbol \"%s\"", funcname);
|
||||
if (addr)
|
||||
return (void *) (uintptr_t) addr;
|
||||
if (LLVMOrcGetSymbolAddress(llvm_opt3_orc, &addr, funcname))
|
||||
elog(ERROR, "failed to look up symbol \"%s\"", funcname);
|
||||
if (addr)
|
||||
return (void *) (uintptr_t) addr;
|
||||
}
|
||||
#endif
|
||||
|
||||
elog(ERROR, "failed to JIT: %s", funcname);
|
||||
@@ -553,12 +526,8 @@ llvm_copy_attributes_at_index(LLVMValueRef v_from, LLVMValueRef v_to, uint32 ind
|
||||
int num_attributes;
|
||||
LLVMAttributeRef *attrs;
|
||||
|
||||
num_attributes = LLVMGetAttributeCountAtIndexPG(v_from, index);
|
||||
num_attributes = LLVMGetAttributeCountAtIndex(v_from, index);
|
||||
|
||||
/*
|
||||
* Not just for efficiency: LLVM <= 3.9 crashes when
|
||||
* LLVMGetAttributesAtIndex() is called for an index with 0 attributes.
|
||||
*/
|
||||
if (num_attributes == 0)
|
||||
return;
|
||||
|
||||
@@ -852,7 +821,7 @@ llvm_compile_module(LLVMJitContext *context)
|
||||
|
||||
/* LLVMOrcLLJITAddLLVMIRModuleWithRT takes ownership of the module */
|
||||
}
|
||||
#elif LLVM_VERSION_MAJOR > 6
|
||||
#else
|
||||
{
|
||||
handle->stack = compile_orc;
|
||||
if (LLVMOrcAddEagerlyCompiledIR(compile_orc, &handle->orc_handle, context->module,
|
||||
@@ -861,26 +830,6 @@ llvm_compile_module(LLVMJitContext *context)
|
||||
|
||||
/* LLVMOrcAddEagerlyCompiledIR takes ownership of the module */
|
||||
}
|
||||
#elif LLVM_VERSION_MAJOR > 4
|
||||
{
|
||||
LLVMSharedModuleRef smod;
|
||||
|
||||
smod = LLVMOrcMakeSharedModule(context->module);
|
||||
handle->stack = compile_orc;
|
||||
if (LLVMOrcAddEagerlyCompiledIR(compile_orc, &handle->orc_handle, smod,
|
||||
llvm_resolve_symbol, NULL))
|
||||
elog(ERROR, "failed to JIT module");
|
||||
|
||||
LLVMOrcDisposeSharedModuleRef(smod);
|
||||
}
|
||||
#else /* LLVM 4.0 and 3.9 */
|
||||
{
|
||||
handle->stack = compile_orc;
|
||||
handle->orc_handle = LLVMOrcAddEagerlyCompiledIR(compile_orc, context->module,
|
||||
llvm_resolve_symbol, NULL);
|
||||
|
||||
LLVMDisposeModule(context->module);
|
||||
}
|
||||
#endif
|
||||
|
||||
INSTR_TIME_SET_CURRENT(endtime);
|
||||
|
||||
Reference in New Issue
Block a user