wamrc: More friendly to print help info (#2451)

Allow wamrc to print help info like below:
```bash
wamrc --target=help
wamrc --target-abi=help
wamrc --target=<target> --cpu=help
wamrc --target=<target> --cpu=help --cpu-features=+help
```
This commit is contained in:
TianlongLiang
2023-08-16 05:28:45 +02:00
committed by GitHub
parent 0f18051e66
commit c820643b2b
2 changed files with 52 additions and 11 deletions

View File

@ -2752,6 +2752,16 @@ aot_create_comp_context(const AOTCompData *comp_data, aot_comp_option_t option)
aot_set_last_error("create LLVM target machine failed.");
goto fail;
}
/* If only to create target machine for querying information, early stop
*/
if ((arch && !strcmp(arch, "help")) || (abi && !strcmp(abi, "help"))
|| (cpu && !strcmp(cpu, "help"))
|| (features && !strcmp(features, "+help"))) {
LOG_DEBUG(
"create LLVM target machine only for printing help info.");
goto fail;
}
}
triple = LLVMGetTargetMachineTriple(comp_ctx->target_machine);