Add a --disasm option to clif-util wasm and compile (#713)
- Both the `wasm` and `compile` commands get this new subcommand, and it defaults to false. This means that test runs with `wasm` can request disassembly (the main reason I am doing this) while test runs with `compile` now must request it, this changes current behavior. - Switch to using context.compile_and_emit directly, and make the reloc and trap printers just accumulate output, not print it. This allows us to factor the printing code into the disasm module.
This commit is contained in:
committed by
Benjamin Bouvier
parent
82c6867155
commit
141ccb9e9d
@@ -30,6 +30,7 @@ use std::process;
|
||||
|
||||
mod cat;
|
||||
mod compile;
|
||||
mod disasm;
|
||||
mod print_cfg;
|
||||
mod utils;
|
||||
|
||||
@@ -69,6 +70,19 @@ fn add_time_flag<'a>() -> clap::Arg<'a, 'a> {
|
||||
.help("Print pass timing report for test")
|
||||
}
|
||||
|
||||
fn add_size_flag<'a>() -> clap::Arg<'a, 'a> {
|
||||
Arg::with_name("print-size")
|
||||
.short("X")
|
||||
.help("Print bytecode size")
|
||||
}
|
||||
|
||||
fn add_disasm_flag<'a>() -> clap::Arg<'a, 'a> {
|
||||
Arg::with_name("disasm")
|
||||
.long("disasm")
|
||||
.short("D")
|
||||
.help("Print machine code disassembly")
|
||||
}
|
||||
|
||||
fn add_set_flag<'a>() -> clap::Arg<'a, 'a> {
|
||||
Arg::with_name("set")
|
||||
.long("set")
|
||||
@@ -120,6 +134,8 @@ fn add_wasm_or_compile<'a>(cmd: &str) -> clap::App<'a, 'a> {
|
||||
.arg(add_verbose_flag())
|
||||
.arg(add_print_flag())
|
||||
.arg(add_time_flag())
|
||||
.arg(add_size_flag())
|
||||
.arg(add_disasm_flag())
|
||||
.arg(add_set_flag())
|
||||
.arg(add_target_flag())
|
||||
.arg(add_input_file_arg())
|
||||
@@ -226,6 +242,7 @@ fn main() {
|
||||
compile::run(
|
||||
get_vec(rest_cmd.values_of("file")),
|
||||
rest_cmd.is_present("print"),
|
||||
rest_cmd.is_present("disasm"),
|
||||
rest_cmd.is_present("time-passes"),
|
||||
&get_vec(rest_cmd.values_of("set")),
|
||||
target_val,
|
||||
@@ -247,6 +264,7 @@ fn main() {
|
||||
rest_cmd.is_present("just-decode"),
|
||||
rest_cmd.is_present("check-translation"),
|
||||
rest_cmd.is_present("print"),
|
||||
rest_cmd.is_present("disasm"),
|
||||
&get_vec(rest_cmd.values_of("set")),
|
||||
target_val,
|
||||
rest_cmd.is_present("print-size"),
|
||||
|
||||
Reference in New Issue
Block a user