Commit 4b9094eb authored by Andres Freund's avatar Andres Freund

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
parent 071371bc
...@@ -527,13 +527,17 @@ llvm_compile_module(LLVMJitContext *context) ...@@ -527,13 +527,17 @@ llvm_compile_module(LLVMJitContext *context)
* faster instruction selection mechanism is used. * faster instruction selection mechanism is used.
*/ */
INSTR_TIME_SET_CURRENT(starttime); INSTR_TIME_SET_CURRENT(starttime);
#if LLVM_VERSION_MAJOR < 5 #if LLVM_VERSION_MAJOR > 6
{ {
orc_handle = LLVMOrcAddEagerlyCompiledIR(compile_orc, context->module, if (LLVMOrcAddEagerlyCompiledIR(compile_orc, &orc_handle, context->module,
llvm_resolve_symbol, NULL); llvm_resolve_symbol, NULL))
LLVMDisposeModule(context->module); {
elog(ERROR, "failed to JIT module");
} }
#else
/* LLVMOrcAddEagerlyCompiledIR takes ownership of the module */
}
#elif LLVM_VERSION_MAJOR > 4
{ {
LLVMSharedModuleRef smod; LLVMSharedModuleRef smod;
...@@ -545,6 +549,12 @@ llvm_compile_module(LLVMJitContext *context) ...@@ -545,6 +549,12 @@ llvm_compile_module(LLVMJitContext *context)
} }
LLVMOrcDisposeSharedModuleRef(smod); LLVMOrcDisposeSharedModuleRef(smod);
} }
#else /* LLVM 4.0 and 3.9 */
{
orc_handle = LLVMOrcAddEagerlyCompiledIR(compile_orc, context->module,
llvm_resolve_symbol, NULL);
LLVMDisposeModule(context->module);
}
#endif #endif
INSTR_TIME_SET_CURRENT(endtime); INSTR_TIME_SET_CURRENT(endtime);
INSTR_TIME_ACCUM_DIFF(context->base.emission_counter, INSTR_TIME_ACCUM_DIFF(context->base.emission_counter,
......
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