Use LLVM new pass manager for wamrc (#978)

Use LLVM new pass manager for wamrc to replace the legacy pass manger,
so as to gain better performance and reduce the compilation time.
Reference links:
- https://llvm.org/docs/NewPassManager.html
- https://blog.llvm.org/posts/2021-03-26-the-new-pass-manager

And add an option to use the legacy pm mode when building wamrc:
cmake .. -DWAMR_BUILD_LLVM_LEGACY_PM=1

For JIT mode, keep it unchanged as it only runs several function passes and
using new pass manager will increase the compilation time.

And refactor the codes of applying LLVM passes.
This commit is contained in:
Wenyong Huang
2022-01-24 11:10:37 +08:00
committed by GitHub
parent 7636d86a76
commit 5631a2aa18
10 changed files with 390 additions and 447 deletions

View File

@ -83,17 +83,6 @@ aot_emit_aot_file(aot_comp_context_t comp_ctx, aot_comp_data_t comp_data,
void
aot_destroy_aot_file(uint8_t *aot_file);
bool
aot_compile_wasm_file_init();
uint8_t *
aot_compile_wasm_file(const uint8_t *wasm_file_buf, uint32_t wasm_file_size,
uint32_t opt_level, uint32_t size_level, char *error_buf,
uint32_t error_buf_size, uint32_t *p_aot_file_size);
void
aot_compile_wasm_file_destroy();
char *
aot_get_last_error();