]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Reuse general_instr to shorten create_binop
authorWolfgang Bumiller <wolfgang.linux@bumiller.com>
Tue, 1 May 2012 14:26:25 +0000 (16:26 +0200)
committerWolfgang Bumiller <wolfgang.linux@bumiller.com>
Tue, 1 May 2012 14:26:25 +0000 (16:26 +0200)
ir.c

diff --git a/ir.c b/ir.c
index 20754bebd79cf8733a00c57010ffdac3d8b58541..ea3a9cae2229fa3722cc77a71981ba64e8bd9c1a 100644 (file)
--- a/ir.c
+++ b/ir.c
@@ -982,31 +982,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,