]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
ir_block_create_store_op checks whether or not the storetype is an SSA value - do...
authorWolfgang (Blub) Bumiller <blub@speed.at>
Sat, 11 Aug 2012 14:38:17 +0000 (16:38 +0200)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Sat, 11 Aug 2012 14:38:17 +0000 (16:38 +0200)
ir.c

diff --git a/ir.c b/ir.c
index d831176f82e57fb73b8884ccc0abb4cd9f5df909..f9e9fd25e0f9cb5017adc434deb5d8ae253c8d92 100644 (file)
--- a/ir.c
+++ b/ir.c
@@ -906,22 +906,26 @@ bool ir_values_overlap(const ir_value *a, const ir_value *b)
 
 bool ir_block_create_store_op(ir_block *self, int op, ir_value *target, ir_value *what)
 {
-    if (target->store == store_value) {
+    ir_instr *in = ir_instr_new(self, op);
+    if (!in)
+        return false;
+
+    if (target->store == store_value &&
+        (op < INSTR_STOREP_F || op > INSTR_STOREP_FNC))
+    {
         fprintf(stderr, "cannot store to an SSA value\n");
         fprintf(stderr, "trying to store: %s <- %s\n", target->name, what->name);
+        fprintf(stderr, "instruction: %s\n", asm_instr[op].m);
+        return false;
+    }
+
+    if (!ir_instr_op(in, 0, target, true) ||
+        !ir_instr_op(in, 1, what, false)  ||
+        !ir_block_instr_add(self, in) )
+    {
         return false;
-    } else {
-        ir_instr *in = ir_instr_new(self, op);
-        if (!in)
-            return false;
-        if (!ir_instr_op(in, 0, target, true) ||
-            !ir_instr_op(in, 1, what, false)  ||
-            !ir_block_instr_add(self, in) )
-        {
-            return false;
-        }
-        return true;
     }
+    return true;
 }
 
 bool ir_block_create_store(ir_block *self, ir_value *target, ir_value *what)