From: Wolfgang Bumiller Date: Sun, 23 Dec 2012 20:29:15 +0000 (+0100) Subject: Remove ir_block_create_{add,sub,mul,div}, they're not used; STOREP instructions don... X-Git-Tag: before-library~517 X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=commitdiff_plain;h=63928e231c96db4af5598049eb54d171143f75ea Remove ir_block_create_{add,sub,mul,div}, they're not used; STOREP instructions don't themselves to their target pointer's 'writes' list, but 'reads' list instead --- diff --git a/ir.c b/ir.c index 8a84f1f..99fa805 100644 --- 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 c8e7e0c..a39efca 100644 --- 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);