]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Remove ir_block_create_{add,sub,mul,div}, they're not used; STOREP instructions don...
authorWolfgang Bumiller <blub@speed.at>
Sun, 23 Dec 2012 20:29:15 +0000 (21:29 +0100)
committerWolfgang Bumiller <blub@speed.at>
Sun, 23 Dec 2012 20:29:15 +0000 (21:29 +0100)
ir.c
ir.h

diff --git a/ir.c b/ir.c
index 8a84f1f999d14dbc42102a1d878631f744eb458d..99fa8056edf5616a7f8446be7939254c58184635 100644 (file)
--- a/ir.c
+++ b/ir.c
@@ -1408,7 +1408,7 @@ bool ir_block_create_store_op(ir_block *self, lex_ctx ctx, int op, ir_value *tar
     if (!in)
         return false;
 
-    if (!ir_instr_op(in, 0, target, true) ||
+    if (!ir_instr_op(in, 0, target, (op < INSTR_STOREP_F || op > INSTR_STOREP_FNC)) ||
         !ir_instr_op(in, 1, what, false))
     {
         ir_instr_delete(in);
@@ -1839,175 +1839,6 @@ ir_value* ir_block_create_load_from_ent(ir_block *self, lex_ctx ctx, const char
     return ir_block_create_general_instr(self, ctx, label, op, ent, field, outype);
 }
 
-ir_value* ir_block_create_add(ir_block *self, lex_ctx ctx,
-                              const char *label,
-                              ir_value *left, ir_value *right)
-{
-    int op = 0;
-    int l = left->vtype;
-    int r = right->vtype;
-    if (l == r) {
-        switch (l) {
-            default:
-                irerror(self->context, "invalid type for ir_block_create_add: %s", type_name[l]);
-                return NULL;
-            case TYPE_FLOAT:
-                op = INSTR_ADD_F;
-                break;
-#if 0
-            case TYPE_INTEGER:
-                op = INSTR_ADD_I;
-                break;
-#endif
-            case TYPE_VECTOR:
-                op = INSTR_ADD_V;
-                break;
-        }
-    } else {
-#if 0
-        if ( (l == TYPE_FLOAT && r == TYPE_INTEGER) )
-            op = INSTR_ADD_FI;
-        else if ( (l == TYPE_INTEGER && r == TYPE_FLOAT) )
-            op = INSTR_ADD_IF;
-        else
-#endif
-        {
-            irerror(self->context, "invalid type for ir_block_create_add: %s", type_name[l]);
-            return NULL;
-        }
-    }
-    return ir_block_create_binop(self, ctx, label, op, left, right);
-}
-
-ir_value* ir_block_create_sub(ir_block *self, lex_ctx ctx,
-                              const char *label,
-                              ir_value *left, ir_value *right)
-{
-    int op = 0;
-    int l = left->vtype;
-    int r = right->vtype;
-    if (l == r) {
-
-        switch (l) {
-            default:
-                irerror(self->context, "invalid type for ir_block_create_sub: %s", type_name[l]);
-                return NULL;
-            case TYPE_FLOAT:
-                op = INSTR_SUB_F;
-                break;
-#if 0
-            case TYPE_INTEGER:
-                op = INSTR_SUB_I;
-                break;
-#endif
-            case TYPE_VECTOR:
-                op = INSTR_SUB_V;
-                break;
-        }
-    } else {
-#if 0
-        if ( (l == TYPE_FLOAT && r == TYPE_INTEGER) )
-            op = INSTR_SUB_FI;
-        else if ( (l == TYPE_INTEGER && r == TYPE_FLOAT) )
-            op = INSTR_SUB_IF;
-        else
-#endif
-        {
-            irerror(self->context, "invalid type for ir_block_create_sub: %s", type_name[l]);
-            return NULL;
-        }
-    }
-    return ir_block_create_binop(self, ctx, label, op, left, right);
-}
-
-ir_value* ir_block_create_mul(ir_block *self, lex_ctx ctx,
-                              const char *label,
-                              ir_value *left, ir_value *right)
-{
-    int op = 0;
-    int l = left->vtype;
-    int r = right->vtype;
-    if (l == r) {
-
-        switch (l) {
-            default:
-                irerror(self->context, "invalid type for ir_block_create_mul: %s", type_name[l]);
-                return NULL;
-            case TYPE_FLOAT:
-                op = INSTR_MUL_F;
-                break;
-#if 0
-            case TYPE_INTEGER:
-                op = INSTR_MUL_I;
-                break;
-#endif
-            case TYPE_VECTOR:
-                op = INSTR_MUL_V;
-                break;
-        }
-    } else {
-        if ( (l == TYPE_VECTOR && r == TYPE_FLOAT) )
-            op = INSTR_MUL_VF;
-        else if ( (l == TYPE_FLOAT && r == TYPE_VECTOR) )
-            op = INSTR_MUL_FV;
-#if 0
-        else if ( (l == TYPE_VECTOR && r == TYPE_INTEGER) )
-            op = INSTR_MUL_VI;
-        else if ( (l == TYPE_INTEGER && r == TYPE_VECTOR) )
-            op = INSTR_MUL_IV;
-        else if ( (l == TYPE_FLOAT && r == TYPE_INTEGER) )
-            op = INSTR_MUL_FI;
-        else if ( (l == TYPE_INTEGER && r == TYPE_FLOAT) )
-            op = INSTR_MUL_IF;
-#endif
-        else {
-            irerror(self->context, "invalid type for ir_block_create_mul: %s", type_name[l]);
-            return NULL;
-        }
-    }
-    return ir_block_create_binop(self, ctx, label, op, left, right);
-}
-
-ir_value* ir_block_create_div(ir_block *self, lex_ctx ctx,
-                              const char *label,
-                              ir_value *left, ir_value *right)
-{
-    int op = 0;
-    int l = left->vtype;
-    int r = right->vtype;
-    if (l == r) {
-
-        switch (l) {
-            default:
-                irerror(self->context, "invalid type for ir_block_create_div: %s", type_name[l]);
-                return NULL;
-            case TYPE_FLOAT:
-                op = INSTR_DIV_F;
-                break;
-#if 0
-            case TYPE_INTEGER:
-                op = INSTR_DIV_I;
-                break;
-#endif
-        }
-    } else {
-#if 0
-        if ( (l == TYPE_VECTOR && r == TYPE_FLOAT) )
-            op = INSTR_DIV_VF;
-        else if ( (l == TYPE_FLOAT && r == TYPE_INTEGER) )
-            op = INSTR_DIV_FI;
-        else if ( (l == TYPE_INTEGER && r == TYPE_FLOAT) )
-            op = INSTR_DIV_IF;
-        else
-#endif
-        {
-            irerror(self->context, "invalid type for ir_block_create_div: %s", type_name[l]);
-            return NULL;
-        }
-    }
-    return ir_block_create_binop(self, ctx, label, op, left, right);
-}
-
 /* PHI resolving breaks the SSA, and must thus be the last
  * step before life-range calculation.
  */
diff --git a/ir.h b/ir.h
index c8e7e0c162f0caf5e12315cc9633e88429c7248c..a39efca1bcdf973f10c395c6a97471aff93a0027 100644 (file)
--- a/ir.h
+++ b/ir.h
@@ -202,10 +202,6 @@ ir_value* ir_block_create_fieldaddress(ir_block*, lex_ctx, const char *label, ir
 ir_value* ir_block_create_general_instr(ir_block *self, lex_ctx, const char *label,
                                         int op, ir_value *a, ir_value *b, int outype);
 
-ir_value* ir_block_create_add(ir_block*, lex_ctx, const char *label, ir_value *l, ir_value *r);
-ir_value* ir_block_create_sub(ir_block*, lex_ctx, const char *label, ir_value *l, ir_value *r);
-ir_value* ir_block_create_mul(ir_block*, lex_ctx, const char *label, ir_value *l, ir_value *r);
-ir_value* ir_block_create_div(ir_block*, lex_ctx, const char *label, ir_value *l, ir_value *r);
 ir_instr* ir_block_create_phi(ir_block*, lex_ctx, const char *label, int vtype);
 ir_value* ir_phi_value(ir_instr*);
 void ir_phi_add(ir_instr*, ir_block *b, ir_value *v);