Skip to content

Commit 4b9094e

Browse files
committed
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
1 parent 071371b commit 4b9094e

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/backend/jit/llvm/llvmjit.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -527,13 +527,17 @@ llvm_compile_module(LLVMJitContext *context)
527527
* faster instruction selection mechanism is used.
528528
*/
529529
INSTR_TIME_SET_CURRENT(starttime);
530-
#if LLVM_VERSION_MAJOR < 5
530+
#if LLVM_VERSION_MAJOR > 6
531531
{
532-
orc_handle = LLVMOrcAddEagerlyCompiledIR(compile_orc, context->module,
533-
llvm_resolve_symbol, NULL);
534-
LLVMDisposeModule(context->module);
532+
if (LLVMOrcAddEagerlyCompiledIR(compile_orc, &orc_handle, context->module,
533+
llvm_resolve_symbol, NULL))
534+
{
535+
elog(ERROR, "failed to JIT module");
536+
}
537+
538+
/* LLVMOrcAddEagerlyCompiledIR takes ownership of the module */
535539
}
536-
#else
540+
#elif LLVM_VERSION_MAJOR > 4
537541
{
538542
LLVMSharedModuleRef smod;
539543

@@ -545,6 +549,12 @@ llvm_compile_module(LLVMJitContext *context)
545549
}
546550
LLVMOrcDisposeSharedModuleRef(smod);
547551
}
552+
#else /* LLVM 4.0 and 3.9 */
553+
{
554+
orc_handle = LLVMOrcAddEagerlyCompiledIR(compile_orc, context->module,
555+
llvm_resolve_symbol, NULL);
556+
LLVMDisposeModule(context->module);
557+
}
548558
#endif
549559
INSTR_TIME_SET_CURRENT(endtime);
550560
INSTR_TIME_ACCUM_DIFF(context->base.emission_counter,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy