mirror of
https://github.com/danog/ir.git
synced 2024-11-26 20:34:53 +01:00
Add "--dump-size" option
This commit is contained in:
parent
637fe28e90
commit
8b4678a9ae
@ -29,6 +29,8 @@ static void help(const char *cmd)
|
||||
" --dump-after-live-ranges - dump IR after live ranges identification\n"
|
||||
" --dump-after-coalescing - dump IR after live ranges coalescing\n"
|
||||
" --dump-after-all - dump IR after each pass\n"
|
||||
" --dump-final - dump IR after all pass\n"
|
||||
" --dump-size - dump generated code size\n"
|
||||
" --dump-use-lists - dump def->use lists\n"
|
||||
" --dump-cfg - dump CFG (Control Flow Graph)\n"
|
||||
" --dump-cfg-map - dump CFG map (instruction to BB number)\n"
|
||||
@ -226,6 +228,7 @@ int main(int argc, char **argv)
|
||||
int opt_level = 2;
|
||||
uint32_t mflags = 0;
|
||||
uint64_t debug_regset = 0xffffffffffffffff;
|
||||
bool dump_size = 0;
|
||||
|
||||
ir_consistency_check();
|
||||
|
||||
@ -300,6 +303,8 @@ int main(int argc, char **argv)
|
||||
dump |= IR_DUMP_AFTER_ALL;
|
||||
} else if (strcmp(argv[i], "--dump-final") == 0) {
|
||||
dump |= IR_DUMP_FINAL;
|
||||
} else if (strcmp(argv[i], "--dump-size") == 0) {
|
||||
dump_size = 1;
|
||||
} else if (strcmp(argv[i], "-S") == 0) {
|
||||
dump_asm = 1;
|
||||
} else if (strcmp(argv[i], "--run") == 0) {
|
||||
@ -408,6 +413,9 @@ int main(int argc, char **argv)
|
||||
ir_disasm_add_symbol("test", (uintptr_t)entry, size);
|
||||
ir_disasm("test", entry, size, 0, &ctx, stderr);
|
||||
}
|
||||
if (dump_size) {
|
||||
fprintf(stderr, "\ncode size = %lld\n", (long long int)size);
|
||||
}
|
||||
if (run) {
|
||||
int (*func)(void) = entry;
|
||||
int ret;
|
||||
|
Loading…
Reference in New Issue
Block a user