From: Wolfgang (Blub) Bumiller Date: Wed, 21 Nov 2012 20:53:38 +0000 (+0100) Subject: -dump vs -dumpfin; to see the IR before and after finalizing functions X-Git-Tag: 0.1.9~358^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6983142c4d782bcb49595eeca0fb8883ecd9479c;p=xonotic%2Fgmqcc.git -dump vs -dumpfin; to see the IR before and after finalizing functions --- diff --git a/gmqcc.h b/gmqcc.h index 7bd1a9f..b252d86 100644 --- a/gmqcc.h +++ b/gmqcc.h @@ -830,6 +830,7 @@ extern const char *opts_output; /* -o file */ extern int opts_standard; extern bool opts_debug; extern bool opts_memchk; +extern bool opts_dumpfin; extern bool opts_dump; extern bool opts_werror; extern bool opts_forcecrc; diff --git a/main.c b/main.c index fd34c92..2078079 100644 --- a/main.c +++ b/main.c @@ -32,6 +32,7 @@ const char *opts_output = "progs.dat"; int opts_standard = COMPILER_GMQCC; bool opts_debug = false; bool opts_memchk = false; +bool opts_dumpfin = false; bool opts_dump = false; bool opts_werror = false; bool opts_forcecrc = false; @@ -237,6 +238,10 @@ static bool options_parse(int argc, char **argv) { opts_dump = true; continue; } + if (!strcmp(argv[0]+1, "dumpfin")) { + opts_dumpfin = true; + continue; + } if (!strcmp(argv[0]+1, "memchk")) { opts_memchk = true; continue; diff --git a/parser.c b/parser.c index 94bcc62..dec6a77 100644 --- a/parser.c +++ b/parser.c @@ -3921,6 +3921,10 @@ bool parser_finish(const char *output) ir_builder_delete(ir); return false; } + } + if (opts_dump) + ir_builder_dump(ir, con_out); + for (i = 0; i < vec_size(parser->functions); ++i) { if (!ir_function_finalize(parser->functions[i]->ir_func)) { con_out("failed to finalize function %s\n", parser->functions[i]->name); ir_builder_delete(ir); @@ -3929,7 +3933,7 @@ bool parser_finish(const char *output) } if (retval) { - if (opts_dump) + if (opts_dumpfin) ir_builder_dump(ir, con_out); generate_checksum(parser);