ソースを参照

Fix build wamrc for xtensa failure (#1109)

Fix build wamrc failure when using llvm xtensa version, and update
xtensa llvm version to 13.0.0.
Wenyong Huang 3 年 前
コミット
9b858c43cb

+ 1 - 1
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",

+ 3 - 3
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");

+ 5 - 3
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 */