mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-09 13:16:26 +00:00
Fix wamrc build error with llvm-14 (#1140)
Fix aot compiler compilation errors when the llvm version is 14.0, and clear one compilation warning of thread_manager.c.
This commit is contained in:
parent
c6997aa68a
commit
749f2f1f34
|
@ -111,9 +111,15 @@ WAMRCreateMCJITCompilerForModule(LLVMExecutionEngineRef *OutJIT,
|
||||||
for (auto &F : *Mod) {
|
for (auto &F : *Mod) {
|
||||||
auto Attrs = F.getAttributes();
|
auto Attrs = F.getAttributes();
|
||||||
StringRef Value = options.NoFramePointerElim ? "all" : "none";
|
StringRef Value = options.NoFramePointerElim ? "all" : "none";
|
||||||
|
#if LLVM_VERSION_MAJOR <= 13
|
||||||
Attrs =
|
Attrs =
|
||||||
Attrs.addAttribute(F.getContext(), AttributeList::FunctionIndex,
|
Attrs.addAttribute(F.getContext(), AttributeList::FunctionIndex,
|
||||||
"frame-pointer", Value);
|
"frame-pointer", Value);
|
||||||
|
#else
|
||||||
|
Attrs = Attrs.addAttributeAtIndex(F.getContext(),
|
||||||
|
AttributeList::FunctionIndex,
|
||||||
|
"frame-pointer", Value);
|
||||||
|
#endif
|
||||||
F.setAttributes(Attrs);
|
F.setAttributes(Attrs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -356,8 +362,14 @@ aot_func_disable_tce(LLVMValueRef func)
|
||||||
Function *F = unwrap<Function>(func);
|
Function *F = unwrap<Function>(func);
|
||||||
auto Attrs = F->getAttributes();
|
auto Attrs = F->getAttributes();
|
||||||
|
|
||||||
|
#if LLVM_VERSION_MAJOR <= 13
|
||||||
Attrs = Attrs.addAttribute(F->getContext(), AttributeList::FunctionIndex,
|
Attrs = Attrs.addAttribute(F->getContext(), AttributeList::FunctionIndex,
|
||||||
"disable-tail-calls", "true");
|
"disable-tail-calls", "true");
|
||||||
|
#else
|
||||||
|
Attrs =
|
||||||
|
Attrs.addAttributeAtIndex(F->getContext(), AttributeList::FunctionIndex,
|
||||||
|
"disable-tail-calls", "true");
|
||||||
|
#endif
|
||||||
F->setAttributes(Attrs);
|
F->setAttributes(Attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,6 +416,7 @@ aot_apply_llvm_new_pass_manager(AOTCompContext *comp_ctx)
|
||||||
|
|
||||||
ModulePassManager MPM;
|
ModulePassManager MPM;
|
||||||
|
|
||||||
|
#if LLVM_VERSION_MAJOR <= 13
|
||||||
PassBuilder::OptimizationLevel OL;
|
PassBuilder::OptimizationLevel OL;
|
||||||
|
|
||||||
switch (comp_ctx->opt_level) {
|
switch (comp_ctx->opt_level) {
|
||||||
|
@ -421,6 +434,25 @@ aot_apply_llvm_new_pass_manager(AOTCompContext *comp_ctx)
|
||||||
OL = PassBuilder::OptimizationLevel::O3;
|
OL = PassBuilder::OptimizationLevel::O3;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
OptimizationLevel OL;
|
||||||
|
|
||||||
|
switch (comp_ctx->opt_level) {
|
||||||
|
case 0:
|
||||||
|
OL = OptimizationLevel::O0;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
OL = OptimizationLevel::O1;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
OL = OptimizationLevel::O2;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
default:
|
||||||
|
OL = OptimizationLevel::O3;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif /* end of LLVM_VERSION_MAJOR */
|
||||||
|
|
||||||
if (comp_ctx->disable_llvm_lto) {
|
if (comp_ctx->disable_llvm_lto) {
|
||||||
disable_llvm_lto = true;
|
disable_llvm_lto = true;
|
||||||
|
|
|
@ -808,7 +808,6 @@ wait_for_thread_visitor(void *node, void *user_data)
|
||||||
{
|
{
|
||||||
WASMExecEnv *curr_exec_env = (WASMExecEnv *)node;
|
WASMExecEnv *curr_exec_env = (WASMExecEnv *)node;
|
||||||
WASMExecEnv *exec_env = (WASMExecEnv *)user_data;
|
WASMExecEnv *exec_env = (WASMExecEnv *)user_data;
|
||||||
korp_tid handle;
|
|
||||||
|
|
||||||
if (curr_exec_env == exec_env)
|
if (curr_exec_env == exec_env)
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user