diff --git a/build-scripts/build_llvm.py b/build-scripts/build_llvm.py index e5bcab750..4e37e390b 100755 --- a/build-scripts/build_llvm.py +++ b/build-scripts/build_llvm.py @@ -208,7 +208,7 @@ def main(): }, "xtensa": { "repo": "https://github.com/espressif/llvm-project.git", - "branch": "xtensa_release_11.0.0", + "branch": "xtensa_release_13.0.0", }, "default": { "repo": "https://github.com/llvm/llvm-project.git", diff --git a/core/iwasm/compilation/aot_compiler.c b/core/iwasm/compilation/aot_compiler.c index a0177be5e..d1bb081ad 100644 --- a/core/iwasm/compilation/aot_compiler.c +++ b/core/iwasm/compilation/aot_compiler.c @@ -2670,7 +2670,7 @@ apply_func_passes(AOTCompContext *comp_ctx) return true; } -#if WASM_ENABLE_LLVM_LEGACY_PM != 0 +#if WASM_ENABLE_LLVM_LEGACY_PM != 0 || LLVM_VERSION_MAJOR < 12 static bool apply_lto_passes(AOTCompContext *comp_ctx) { @@ -2709,7 +2709,7 @@ apply_lto_passes(AOTCompContext *comp_ctx) LLVMPassManagerBuilderDispose(pass_mgr_builder); return true; } -#endif +#endif /* end of WASM_ENABLE_LLVM_LEGACY_PM != 0 || LLVM_VERSION_MAJOR < 12 */ /* Check whether the target supports hardware atomic instructions */ static bool @@ -2816,7 +2816,7 @@ aot_compile_wasm(AOTCompContext *comp_ctx) } } else { -#if WASM_ENABLE_LLVM_LEGACY_PM == 0 +#if WASM_ENABLE_LLVM_LEGACY_PM == 0 && LLVM_VERSION_MAJOR >= 12 /* Run llvm new pass manager for AOT compiler if llvm legacy pass manager isn't used */ bh_print_time("Begin to run llvm optimization passes"); diff --git a/core/iwasm/compilation/aot_llvm_extra.cpp b/core/iwasm/compilation/aot_llvm_extra.cpp index 45aeb9cdd..0f2373e6c 100644 --- a/core/iwasm/compilation/aot_llvm_extra.cpp +++ b/core/iwasm/compilation/aot_llvm_extra.cpp @@ -293,6 +293,8 @@ aot_check_simd_compatibility(const char *arch_c_str, const char *cpu_c_str) #endif /* WASM_ENABLE_SIMD */ } +#if WASM_ENABLE_LAZY_JIT != 0 + #if LLVM_VERSION_MAJOR < 12 LLVMOrcJITTargetMachineBuilderRef LLVMOrcJITTargetMachineBuilderFromTargetMachine(LLVMTargetMachineRef TM); @@ -304,8 +306,6 @@ LLVMOrcJITTargetMachineBuilderCreateFromTargetMachine(LLVMTargetMachineRef TM) } #endif -#if WASM_ENABLE_LAZY_JIT != 0 - DEFINE_SIMPLE_CONVERSION_FUNCTIONS(LLJITBuilder, LLVMOrcLLJITBuilderRef) void @@ -348,7 +348,7 @@ aot_lookup_orcjit_func(LLVMOrcLLJITRef orc_lazyjit, void *module_inst, func_ptrs[func_idx] = (void *)func_addr; return (void *)func_addr; } -#endif +#endif /* end of WASM_ENABLE_LAZY_JIT != 0 */ void aot_func_disable_tce(LLVMValueRef func) @@ -361,6 +361,7 @@ aot_func_disable_tce(LLVMValueRef func) F->setAttributes(Attrs); } +#if LLVM_VERSION_MAJOR >= 12 void aot_apply_llvm_new_pass_manager(AOTCompContext *comp_ctx) { @@ -478,3 +479,4 @@ aot_apply_llvm_new_pass_manager(AOTCompContext *comp_ctx) } #endif } +#endif /* end of LLVM_VERSION_MAJOR >= 12 */