diff --git a/main/minivm.c b/main/minivm.c index c447423b..1eb73f7a 100644 --- a/main/minivm.c +++ b/main/minivm.c @@ -163,6 +163,8 @@ int main(int argc, char **argv) { config->dump_tb_opt = true; } else if (!strcmp(arg, "asm")) { config->dump_asm = true; + } else if (!strcmp(arg, "c")) { + config->dump_c = true; } else if (!strcmp(arg, "args")) { config->dump_args = true; } else if (!strcmp(arg, "time")) { diff --git a/vm/backend/tb.c b/vm/backend/tb.c index b150edca..e0a5014e 100644 --- a/vm/backend/tb.c +++ b/vm/backend/tb.c @@ -68,7 +68,7 @@ vm_std_value_t vm_tb_run_repl(vm_config_t *config, vm_block_t *entry, vm_blocks_ tb_c_print_prelude(cbuf, mod); tb_c_print_function(cbuf, fun, worklist, tmp_arena); const char *buf = tb_c_buf_to_data(cbuf); - if (config->dump_asm) { + if (config->dump_c) { printf("\n--- c ---\n%s", buf); } TCCState *state = tcc_new(); diff --git a/vm/backend/tb_dyn.h b/vm/backend/tb_dyn.h index cc51d392..a45cae45 100644 --- a/vm/backend/tb_dyn.h +++ b/vm/backend/tb_dyn.h @@ -1290,7 +1290,7 @@ vm_tb_dyn_func_t *vm_tb_dyn_comp(vm_tb_dyn_state_t *state, vm_block_t *entry) { } } const char *buf = tb_c_buf_to_data(cbuf); - if (state->config->dump_asm) { + if (state->config->dump_c) { printf("\n--- c ---\n%s", buf); } TCCState *state = tcc_new(); diff --git a/vm/backend/tb_ver.h b/vm/backend/tb_ver.h index 86578e07..7fbd35cc 100644 --- a/vm/backend/tb_ver.h +++ b/vm/backend/tb_ver.h @@ -1855,7 +1855,7 @@ static void *vm_tb_ver_rfunc_comp(vm_rblock_t *rblock) { tb_c_print_prelude(cbuf, state->module); tb_c_print_function(cbuf, f, worklist, state->tmp_arena); const char *buf = tb_c_buf_to_data(cbuf); - if (state->config->dump_asm) { + if (state->config->dump_c) { printf("\n--- c ---\n%s", buf); } TCCState *state = tcc_new(); diff --git a/vm/config.h b/vm/config.h index 66367ad7..99085eb9 100644 --- a/vm/config.h +++ b/vm/config.h @@ -56,6 +56,7 @@ struct vm_config_t { bool dump_tb : 1; bool dump_tb_opt : 1; bool dump_asm : 1; + bool dump_c : 1; bool dump_args : 1; bool dump_time : 1;