diff options
Diffstat (limited to 'src/backend/jit/llvm/llvmjit.c')
-rw-r--r-- | src/backend/jit/llvm/llvmjit.c | 57 |
1 files changed, 3 insertions, 54 deletions
diff --git a/src/backend/jit/llvm/llvmjit.c b/src/backend/jit/llvm/llvmjit.c index 7e1d348e6b6..ec0fdd49324 100644 --- a/src/backend/jit/llvm/llvmjit.c +++ b/src/backend/jit/llvm/llvmjit.c @@ -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); |