X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=ir.c;h=52e2ee40c1c02e7941b2e172e2c77508114a3bbd;hb=a9ab865add301e49390d1ebeabe350a6c9c4205c;hp=3fe990851f6a1dd5cb95931b03d2208c4e354980;hpb=bbffdde2dc5503cc6da92b4e7291c5b5e139de98;p=xonotic%2Fgmqcc.git diff --git a/ir.c b/ir.c index 3fe9908..52e2ee4 100644 --- a/ir.c +++ b/ir.c @@ -1493,7 +1493,7 @@ bool ir_block_create_store_op(ir_block *self, lex_ctx ctx, int op, ir_value *tar { irerror(self->context, "cannot store to an SSA value"); irerror(self->context, "trying to store: %s <- %s", target->name, what->name); - irerror(self->context, "instruction: %s", asm_instr[op].m); + irerror(self->context, "instruction: %s", util_instr_str[op]); return false; } @@ -1807,21 +1807,21 @@ ir_value* ir_block_create_binop(ir_block *self, lex_ctx ctx, default: /* ranges: */ /* boolean operations result in floats */ - + /* * opcode >= 10 takes true branch opcode is at least 10 * opcode <= 23 takes false branch opcode is at least 24 */ if (opcode >= INSTR_EQ_F && opcode <= INSTR_GT) ot = TYPE_FLOAT; - - /* - * At condition "opcode <= 23", the value of "opcode" must be + + /* + * At condition "opcode <= 23", the value of "opcode" must be * at least 24. * At condition "opcode <= 23", the value of "opcode" cannot be * equal to any of {1, 2, 3, 4, 5, 6, 7, 8, 9, 62, 63, 64, 65}. * The condition "opcode <= 23" cannot be true. - * + * * Thus ot=2 (TYPE_FLOAT) can never be true */ #if 0 @@ -2625,7 +2625,7 @@ bool ir_function_calculate_liferanges(ir_function *self) if (v->memberof) { ir_value *vec = v->memberof; for (s = 0; s < vec_size(vec->reads); ++s) { - if (vec->reads[s]->eid == vec->life[0].end) + if (vec->reads[s]->eid == v->life[0].end) break; } if (s < vec_size(vec->reads)) { @@ -3736,9 +3736,10 @@ bool ir_builder_generate(ir_builder *self, const char *filename) static const char *qc_opname(int op) { if (op < 0) return ""; - if (op < (int)( sizeof(asm_instr) / sizeof(asm_instr[0]) )) - return asm_instr[op].m; + if (op < VINSTR_END) + return util_instr_str[op]; switch (op) { + case VINSTR_END: return "END"; case VINSTR_PHI: return "PHI"; case VINSTR_JUMP: return "JUMP"; case VINSTR_COND: return "COND"; @@ -3910,7 +3911,7 @@ void ir_instr_dump(ir_instr *in, char *ind, return; } - strncat(ind, "\t", IND_BUFSZ); + strncat(ind, "\t", IND_BUFSZ-1); if (in->_ops[0] && (in->_ops[1] || in->_ops[2])) { ir_value_dump(in->_ops[0], oprintf);