Enable aot compiler with llvm-14/15 (#1252)

Enable aot compiler and jit based on llvm-14.0 and llvm-15.0git,
replace LLVMBuildLoad/LLVMBuildInBoundsGEP/LLVMBuildCall with
LLVMBuildLoad2/LLVMBuildInBoundsGEP2/LLVMBuildCall2, and pass
them with related types, so as to meet the requirements of opaque
pointers.

And fix several compilation errors for llvm-14.0/15.0git.

Most spec cases and standalone cases are tested.
This commit is contained in:
Wenyong Huang
2022-06-28 14:53:01 +08:00
committed by GitHub
parent 2746d29751
commit 5e238322c2
12 changed files with 431 additions and 301 deletions

View File

@ -677,9 +677,9 @@ check_suspend_flags(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx)
/* Offset of suspend_flags */
offset = I32_FIVE;
if (!(terminate_addr =
LLVMBuildInBoundsGEP(comp_ctx->builder, func_ctx->exec_env,
&offset, 1, "terminate_addr"))) {
if (!(terminate_addr = LLVMBuildInBoundsGEP2(
comp_ctx->builder, OPQ_PTR_TYPE, func_ctx->exec_env, &offset, 1,
"terminate_addr"))) {
aot_set_last_error("llvm build in bounds gep failed");
return false;
}
@ -690,8 +690,9 @@ check_suspend_flags(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx)
return false;
}
if (!(terminate_flags = LLVMBuildLoad(comp_ctx->builder, terminate_addr,
"terminate_flags"))) {
if (!(terminate_flags =
LLVMBuildLoad2(comp_ctx->builder, I32_TYPE, terminate_addr,
"terminate_flags"))) {
aot_set_last_error("llvm build bit cast failed");
return false;
}