From: Wolfgang (Blub) Bumiller Date: Tue, 18 Dec 2012 10:46:26 +0000 (+0100) Subject: Don't generate AINSTR_END anymore, use INSTR_DONE X-Git-Tag: 0.1.9~69 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=83a41d13c07c21371a5205c8b0f9e5d4878d0dc7;p=xonotic%2Fgmqcc.git Don't generate AINSTR_END anymore, use INSTR_DONE --- diff --git a/code.c b/code.c index ca6c3ad..964797f 100644 --- a/code.c +++ b/code.c @@ -213,7 +213,7 @@ bool code_write(const char *filename, const char *lnofile) { if (code_functions[it].entry >= 0) { util_debug("GEN", " CODE:\n"); for (;;) { - if (code_statements[j].opcode != AINSTR_END) + if (code_statements[j].opcode != INSTR_DONE) util_debug("GEN", " %-12s {% 5i,% 5i,% 5i}\n", asm_instr[code_statements[j].opcode].m, code_statements[j].o1.s1, diff --git a/exec.c b/exec.c index 2ddaa3a..6d66ef2 100644 --- a/exec.c +++ b/exec.c @@ -986,7 +986,7 @@ void prog_disasm_function(qc_program *prog, size_t id) printf("FUNCTION \"%s\"\n", prog_getstring(prog, fdef->name)); st = prog->code + fdef->entry; - while (st->opcode != AINSTR_END) { + while (st->opcode != INSTR_DONE) { prog_print_statement(prog, st); ++st; } diff --git a/ir.c b/ir.c index 2cffb9d..9f6abb2 100644 --- a/ir.c +++ b/ir.c @@ -2929,8 +2929,8 @@ static bool gen_function_code(ir_function *self) return false; } - /* otherwise code_write crashes since it debug-prints functions until AINSTR_END */ - stmt.opcode = AINSTR_END; + /* code_write and qcvm -disasm need to know that the function ends here */ + stmt.opcode = INSTR_DONE; stmt.o1.u1 = 0; stmt.o2.u1 = 0; stmt.o3.u1 = 0; @@ -3397,15 +3397,15 @@ bool ir_builder_generate(ir_builder *self, const char *filename) return false; } - /* DP errors if the last instruction is not an INSTR_DONE - * and for debugging purposes we add an additional AINSTR_END - * to the end of functions, so here it goes: - */ - stmt.opcode = INSTR_DONE; - stmt.o1.u1 = 0; - stmt.o2.u1 = 0; - stmt.o3.u1 = 0; - code_push_statement(&stmt, vec_last(code_linenums)); + /* DP errors if the last instruction is not an INSTR_DONE. */ + if (vec_last(code_statements).opcode != INSTR_DONE) + { + stmt.opcode = INSTR_DONE; + stmt.o1.u1 = 0; + stmt.o2.u1 = 0; + stmt.o3.u1 = 0; + code_push_statement(&stmt, vec_last(code_linenums)); + } if (opts.pp_only) return true;