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

This commit is contained in:
Wolfgang Bumiller 2012-12-23 21:29:15 +01:00
parent 435dee935b
commit 63928e231c
2 changed files with 1 additions and 174 deletions

171
ir.c
View file

@ -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.
*/

4
ir.h
View file

@ -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);