From: Wolfgang Bumiller Date: Fri, 20 Jul 2012 19:42:36 +0000 (+0200) Subject: ast_binary_new should determine the return type... X-Git-Tag: 0.1-rc1~403 X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=commitdiff_plain;h=45933d2ce9e4a9a01d32f19bc407f5c1cb50b5f4 ast_binary_new should determine the return type... --- diff --git a/ast.c b/ast.c index b192272..9779f8f 100644 --- a/ast.c +++ b/ast.c @@ -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; } diff --git a/ir.c b/ir.c index 21d8eac..1457dee 100644 --- a/ir.c +++ b/ir.c @@ -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: