Don't generate AINSTR_END anymore, use INSTR_DONE

This commit is contained in:
Wolfgang (Blub) Bumiller 2012-12-18 11:46:26 +01:00
parent a5e0542f95
commit 83a41d13c0
3 changed files with 13 additions and 13 deletions

2
code.c
View file

@ -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,

2
exec.c
View file

@ -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;
}

22
ir.c
View file

@ -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;