]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
Push definitions when -O0
authorDale Weiler <killfieldengine@gmail.com>
Mon, 25 Feb 2013 08:52:17 +0000 (08:52 +0000)
committerDale Weiler <killfieldengine@gmail.com>
Mon, 25 Feb 2013 08:52:17 +0000 (08:52 +0000)
gmqcc.h
ir.c
opts.c

diff --git a/gmqcc.h b/gmqcc.h
index 206688f4af0f87605d0b71b87c88094e783ef660..2cc0864126451a10d4d13b7fa6328ca654c2f0e6 100644 (file)
--- a/gmqcc.h
+++ b/gmqcc.h
@@ -1192,6 +1192,7 @@ typedef struct {
     uint32_t     warn_backup  [1 + (COUNT_WARNINGS      / 32)];
     uint32_t     werror_backup[1 + (COUNT_WARNINGS      / 32)];
     uint32_t     optimization [1 + (COUNT_OPTIMIZATIONS / 32)];
+    bool         optimizeoff; /* True when -O0 */
 } opts_cmd_t;
 
 extern opts_cmd_t opts;
diff --git a/ir.c b/ir.c
index 50100107b3f281c457374774202995a98358815e..088d70ecee4ca8e20fd4a27492a8d0c4221b444e 100644 (file)
--- a/ir.c
+++ b/ir.c
@@ -3327,7 +3327,9 @@ static bool ir_builder_gen_global(ir_builder *self, ir_value *global, bool isloc
     size_t           i;
     int32_t         *iptr;
     prog_section_def def;
-    bool             pushdef = false;
+    bool             pushdef = opts.optimizeoff;
+
+    printf("STATUS: %s\n", (pushdef) ? "OFF" : "ON");
 
     def.type   = global->vtype;
     def.offset = vec_size(code_globals);
diff --git a/opts.c b/opts.c
index aa923bdeafebd93d42261f4f97e183a89e71f6e6..4b765683099c56e58cfc5979189c61e0ec9db25b 100644 (file)
--- a/opts.c
+++ b/opts.c
@@ -142,6 +142,9 @@ void opts_setoptimlevel(unsigned int level) {
     size_t i;
     for (i = 0; i < COUNT_OPTIMIZATIONS; ++i)
         opts_set(opts.optimization, i, level >= opts_opt_oflag[i]);
+
+    if (!level)
+        opts.optimizeoff = true;
 }
 
 /*