diff options
author | Andres Freund <andres@anarazel.de> | 2018-03-26 15:55:16 -0700 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2018-03-26 16:04:53 -0700 |
commit | 4b9094eb6e14dfdbed61278ea8e51cc846e43579 (patch) | |
tree | 855430a70cd49e282a0a4ea9dc04a9af77c598e4 /src | |
parent | 071371bc43c89d6db923a7f858933f655b150655 (diff) | |
download | postgresql-4b9094eb6e14dfdbed61278ea8e51cc846e43579.tar.gz postgresql-4b9094eb6e14dfdbed61278ea8e51cc846e43579.zip |
Adapt to LLVM 7+ Orc API changes.
This is mostly done to be able to validate features and fixes
submitted to LLVM. Given the size of these changes that seems
acceptable.
Author: Andres Freund
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/jit/llvm/llvmjit.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/backend/jit/llvm/llvmjit.c b/src/backend/jit/llvm/llvmjit.c index 53ac8e4425b..bbb2360232f 100644 --- a/src/backend/jit/llvm/llvmjit.c +++ b/src/backend/jit/llvm/llvmjit.c @@ -527,13 +527,17 @@ llvm_compile_module(LLVMJitContext *context) * faster instruction selection mechanism is used. */ INSTR_TIME_SET_CURRENT(starttime); -#if LLVM_VERSION_MAJOR < 5 +#if LLVM_VERSION_MAJOR > 6 { - orc_handle = LLVMOrcAddEagerlyCompiledIR(compile_orc, context->module, - llvm_resolve_symbol, NULL); - LLVMDisposeModule(context->module); + if (LLVMOrcAddEagerlyCompiledIR(compile_orc, &orc_handle, context->module, + llvm_resolve_symbol, NULL)) + { + elog(ERROR, "failed to JIT module"); + } + + /* LLVMOrcAddEagerlyCompiledIR takes ownership of the module */ } -#else +#elif LLVM_VERSION_MAJOR > 4 { LLVMSharedModuleRef smod; @@ -545,6 +549,12 @@ llvm_compile_module(LLVMJitContext *context) } LLVMOrcDisposeSharedModuleRef(smod); } +#else /* LLVM 4.0 and 3.9 */ + { + orc_handle = LLVMOrcAddEagerlyCompiledIR(compile_orc, context->module, + llvm_resolve_symbol, NULL); + LLVMDisposeModule(context->module); + } #endif INSTR_TIME_SET_CURRENT(endtime); INSTR_TIME_ACCUM_DIFF(context->base.emission_counter, |