From 45933d2ce9e4a9a01d32f19bc407f5c1cb50b5f4 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Fri, 20 Jul 2012 21:42:36 +0200 Subject: [PATCH] ast_binary_new should determine the return type... --- ast.c | 12 ++++++++++++ ir.c | 1 + 2 files changed, 13 insertions(+) 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: -- 2.39.2