For -icount mode to work, there are requirements on the target/ code (notably around marking up "I/O" instructions). Unfortunately we've never documented what these are, which makes it pretty rough for people writing new targets or reviewing changes to existing ones. Does anybody understand what they actually are?
Some more specific questions on the general theme: Q1: the comment on gen_io_end() says: /* * cpu->can_do_io is cleared automatically at the beginning of * each translation block. The cost is minimal and only paid * for -icount, plus it would be very easy to forget doing it * in the translator. Therefore, backends only need to call * gen_io_start. */ but in fact multiple backends *do* call gen_io_end(). When does a backend have to call this, and when not? Or are those all legacy useless calls we should delete? (If so, can we just get rid of this function entirely ?) Q2: is it a requirement that after an insn which is a "known to be an I/O insn" one (like x86 in/out) and which is marked up with gen_io_start()/gen_io_end() that we also end the TB? Or is it OK to generate more insns after that one? If the former, is there somewhere we can assert() that this is done ? Q3: why does gen_tb_start() call gen_io_end()? This is the *start* of the TB so by definition we haven't started doing any IO yet... thanks -- PMM