]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
-dump vs -dumpfin; to see the IR before and after finalizing functions
authorWolfgang (Blub) Bumiller <blub@speed.at>
Wed, 21 Nov 2012 20:53:38 +0000 (21:53 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Wed, 21 Nov 2012 20:53:38 +0000 (21:53 +0100)
gmqcc.h
main.c
parser.c

diff --git a/gmqcc.h b/gmqcc.h
index 7bd1a9f49f1578b6dfde8005d2d303b2311b8116..b252d86dee7d1fe0df528b69e35a2470d92fb9e9 100644 (file)
--- 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 fd34c928fd861b8f13023057cacedf6e2a41d23f..2078079ad6beb33c3a4629f2d61e24d3007c7a5c 100644 (file)
--- 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;
index 94bcc620bd141b72699a0442deb36bad48232638..dec6a77a412348b0d84b5a35725ea657ff453987 100644 (file)
--- 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);