X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=ir.c;h=2375d55368c40d0d52c5e194f70f39a1439622b2;hb=9cb46789f0f1f014a0c800ad0735f56b26996da7;hp=458d2cfe4723119f3bef90e9466df41f88835658;hpb=66e6e6329fb19d8e67ac9b72d0a62dfb6db0cb24;p=xonotic%2Fgmqcc.git diff --git a/ir.c b/ir.c index 458d2cf..2375d55 100644 --- a/ir.c +++ b/ir.c @@ -2743,8 +2743,7 @@ tailcall: ontrue = tmp; } stidx = vec_size(code_statements); - if (stmt.o2.s1 != 1) - code_push_statement(&stmt, instr->context.line); + code_push_statement(&stmt, instr->context.line); /* on false we jump, so add ontrue-path */ if (!gen_blocks_recursive(func, ontrue)) return false; @@ -2754,6 +2753,12 @@ tailcall: if (onfalse->generated) { /* fixup the jump address */ code_statements[stidx].o2.s1 = (onfalse->code_start) - (stidx); + if (code_statements[stidx].o2.s1 == 1) { + code_statements[stidx] = code_statements[stidx+1]; + if (code_statements[stidx].o1.s1 < 0) + code_statements[stidx].o1.s1++; + code_pop_statement(); + } stmt.opcode = vec_last(code_statements).opcode; if (stmt.opcode == INSTR_GOTO || stmt.opcode == INSTR_IF || @@ -2773,6 +2778,12 @@ tailcall: code_push_statement(&stmt, instr->context.line); return true; } + else if (code_statements[stidx].o2.s1 == 1) { + code_statements[stidx] = code_statements[stidx+1]; + if (code_statements[stidx].o1.s1 < 0) + code_statements[stidx].o1.s1++; + code_pop_statement(); + } /* if not, generate now */ block = onfalse; goto tailcall; @@ -3186,7 +3197,7 @@ static void gen_vector_fields(prog_section_field fld, const char *name) if (!name || OPTS_FLAG(SINGLE_VECTOR_DEFS)) return; - def.type = TYPE_FLOAT; + fld.type = TYPE_FLOAT; len = strlen(name);