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