mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-03-12 00:45:28 +00:00
Add "--enable-llvm-passes=<passes>" option to wamrc (#2335)
Add "--enable-llvm-passes=<passes>" option to wamrc for customizing LLVM passes
This commit is contained in:
parent
df98d9fb4a
commit
44f4b4f062
|
@ -2296,6 +2296,9 @@ aot_create_comp_context(const AOTCompData *comp_data, aot_comp_option_t option)
|
|||
if (option->enable_stack_estimation)
|
||||
comp_ctx->enable_stack_estimation = true;
|
||||
|
||||
if (option->llvm_passes)
|
||||
comp_ctx->llvm_passes = option->llvm_passes;
|
||||
|
||||
comp_ctx->opt_level = option->opt_level;
|
||||
comp_ctx->size_level = option->size_level;
|
||||
|
||||
|
|
|
@ -417,6 +417,7 @@ typedef struct AOTCompContext {
|
|||
|
||||
const char *stack_usage_file;
|
||||
char stack_usage_temp_file[64];
|
||||
const char *llvm_passes;
|
||||
} AOTCompContext;
|
||||
|
||||
enum {
|
||||
|
@ -455,6 +456,7 @@ typedef struct AOTCompOption {
|
|||
char **custom_sections;
|
||||
uint32 custom_sections_count;
|
||||
const char *stack_usage_file;
|
||||
const char *llvm_passes;
|
||||
} AOTCompOption, *aot_comp_option_t;
|
||||
|
||||
bool
|
||||
|
|
|
@ -373,6 +373,10 @@ aot_apply_llvm_new_pass_manager(AOTCompContext *comp_ctx, LLVMModuleRef module)
|
|||
|
||||
MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
|
||||
|
||||
if (comp_ctx->llvm_passes) {
|
||||
ExitOnErr(PB.parsePassPipeline(MPM, comp_ctx->llvm_passes));
|
||||
}
|
||||
|
||||
if (!disable_llvm_lto) {
|
||||
/* Apply LTO for AOT mode */
|
||||
if (comp_ctx->comp_data->func_count >= 10
|
||||
|
|
|
@ -67,6 +67,7 @@ typedef struct AOTCompOption {
|
|||
char **custom_sections;
|
||||
uint32_t custom_sections_count;
|
||||
const char *stack_usage_file;
|
||||
const char *llvm_passes;
|
||||
} AOTCompOption, *aot_comp_option_t;
|
||||
|
||||
bool
|
||||
|
|
|
@ -70,6 +70,8 @@ print_help()
|
|||
printf(" --disable-llvm-intrinsics Disable the LLVM built-in intrinsics\n");
|
||||
printf(" --disable-llvm-lto Disable the LLVM link time optimization\n");
|
||||
printf(" --enable-llvm-pgo Enable LLVM PGO (Profile-Guided Optimization)\n");
|
||||
printf(" --enable-llvm-passes=<passes>\n");
|
||||
printf(" Enable the specified LLVM passes, using comma to separate\n");
|
||||
printf(" --use-prof-file=<file> Use profile file collected by LLVM PGO (Profile-Guided Optimization)\n");
|
||||
printf(" --enable-segue[=<flags>] Enable using segment register GS as the base address of linear memory,\n");
|
||||
printf(" only available on linux/linux-sgx x86-64, which may improve performance,\n");
|
||||
|
@ -342,6 +344,11 @@ main(int argc, char *argv[])
|
|||
else if (!strcmp(argv[0], "--enable-llvm-pgo")) {
|
||||
option.enable_llvm_pgo = true;
|
||||
}
|
||||
else if (!strncmp(argv[0], "--enable-llvm-passes=", 21)) {
|
||||
if (argv[0][21] == '\0')
|
||||
PRINT_HELP_AND_EXIT();
|
||||
option.llvm_passes = argv[0] + 21;
|
||||
}
|
||||
else if (!strncmp(argv[0], "--use-prof-file=", 16)) {
|
||||
if (argv[0][16] == '\0')
|
||||
PRINT_HELP_AND_EXIT();
|
||||
|
|
Loading…
Reference in New Issue
Block a user