]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - ir.c
Merge branch 'master' into ast-and-ir
[xonotic/gmqcc.git] / ir.c
diff --git a/ir.c b/ir.c
index 20754bebd79cf8733a00c57010ffdac3d8b58541..a390ad795bde42d965d8dd693b79bc366a98e8fc 100644 (file)
--- a/ir.c
+++ b/ir.c
@@ -846,7 +846,7 @@ ir_instr* ir_block_create_phi(ir_block *self, const char *label, int ot)
     in = ir_instr_new(self, VINSTR_PHI);
     if (!in)
         return NULL;
-    out = ir_value_out(self->owner, label, store_local, ot);
+    out = ir_value_out(self->owner, label, store_value, ot);
     if (!out) {
         ir_instr_delete(in);
         return NULL;
@@ -894,9 +894,6 @@ ir_value* ir_block_create_binop(ir_block *self,
                                 const char *label, int opcode,
                                 ir_value *left, ir_value *right)
 {
-    ir_value *out = NULL;
-    ir_instr *in  = NULL;
-
     int ot = TYPE_VOID;
     switch (opcode) {
         case INSTR_ADD_F:
@@ -982,31 +979,7 @@ ir_value* ir_block_create_binop(ir_block *self,
         return NULL;
     }
 
-    out = ir_value_out(self->owner, label, store_local, ot);
-    if (!out)
-        return NULL;
-
-    in = ir_instr_new(self, opcode);
-    if (!in) {
-        ir_value_delete(out);
-        return NULL;
-    }
-
-    if (!ir_instr_op(in, 0, out, true) ||
-        !ir_instr_op(in, 1, left, false) ||
-        !ir_instr_op(in, 2, right, false) )
-    {
-        goto on_error;
-    }
-
-    if (!ir_block_instr_add(self, in))
-        goto on_error;
-
-    return out;
-on_error:
-    ir_instr_delete(in);
-    ir_value_delete(out);
-    return NULL;
+    return ir_block_create_general_instr(self, label, opcode, left, right, ot);
 }
 
 ir_value* ir_block_create_general_instr(ir_block *self, const char *label,
@@ -1056,6 +1029,7 @@ ir_value* ir_block_create_fieldaddress(ir_block *self, const char *label, ir_val
 
 ir_value* ir_block_create_load_from_ent(ir_block *self, const char *label, ir_value *ent, ir_value *field, int outype)
 {
+    int op;
     if (ent->vtype != TYPE_ENTITY)
         return NULL;