ast_binary_new should determine the return type...

This commit is contained in:
Wolfgang Bumiller 2012-07-20 21:42:36 +02:00
parent 7756cb9205
commit 45933d2ce9
2 changed files with 13 additions and 0 deletions

12
ast.c
View file

@ -170,6 +170,18 @@ ast_binary* ast_binary_new(lex_ctx ctx, int op,
self->left = left;
self->right = right;
if (op >= INSTR_EQ_F && op <= INSTR_GT)
self->expression.vtype = TYPE_FLOAT;
else if (op == INSTR_AND || op == INSTR_OR ||
op == INSTR_BITAND || op == INSTR_BITOR)
self->expression.vtype = TYPE_FLOAT;
else if (op == INSTR_MUL_VF || op == INSTR_MUL_FV)
self->expression.vtype = TYPE_VECTOR;
else if (op == INSTR_MUL_V)
self->expression.vtype = TYPE_FLOAT;
else
self->expression.vtype = left->expression.vtype;
return self;
}

1
ir.c
View file

@ -1175,6 +1175,7 @@ ir_value* ir_block_create_binop(ir_block *self,
case INSTR_ADD_V:
case INSTR_SUB_V:
case INSTR_MUL_VF:
case INSTR_MUL_FV:
#if 0
case INSTR_DIV_VF:
case INSTR_MUL_IV: