From: Wolfgang (Blub) Bumiller Date: Sun, 12 Aug 2012 09:36:28 +0000 (+0200) Subject: ast_binary now keeps track of types X-Git-Tag: 0.1-rc1~346^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=028543db8cc8c0cfc3684805d48488fc3719e7a6;p=xonotic%2Fgmqcc.git ast_binary now keeps track of types --- diff --git a/ast.c b/ast.c index e6d28a6..117f845 100644 --- a/ast.c +++ b/ast.c @@ -211,6 +211,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; } @@ -650,8 +662,10 @@ bool ast_global_codegen(ast_value *self, ir_builder *ir) } v = ir_builder_create_global(ir, self->name, self->expression.vtype); - if (!v) + if (!v) { + printf("ir_builder_create_global failed\n"); return false; + } if (self->isconst) { switch (self->expression.vtype)