]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
ast_binary_new should determine the return type...
authorWolfgang Bumiller <wolfgang.linux@bumiller.com>
Fri, 20 Jul 2012 19:42:36 +0000 (21:42 +0200)
committerWolfgang Bumiller <wolfgang.linux@bumiller.com>
Fri, 20 Jul 2012 19:42:36 +0000 (21:42 +0200)
ast.c
ir.c

diff --git a/ast.c b/ast.c
index b1922729093106c3ae5690130f0f5d77df9d583e..9779f8f64d9b7d73d2f04195ee877689d64da039 100644 (file)
--- 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 21d8eac5a0724a7b09fec1eee7c63989dec342c2..1457deea23149243a6b5694e4239efb093e63b7a 100644 (file)
--- 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: