On 05/20/2011 02:10 AM, Max Filippov wrote: >>> If you're going to pretend that LEND is a constant, you might as well >>> pretend that LBEG is also a constant, so that you get to chain the TB's >>> around the loop. >> >> But there may be three exits from TB at the LEND if its last >> command is a branch: to the LBEG, to the branch target and to the >> next insn. > > Ok, I guess that I need to add gen_wsr_lbeg that invalidates TB at the > current LEND, pretend that LBEG is constant and use given slot to jump > to it. And also to get rid of tcg_gen_brcondi_i32(TCG_COND_NE, > cpu_SR[LEND], dc->next_pc, label);
Yes. Consider that the code is written to assume that the loop cycles, so the most likely exit at LEND is LBEG. If we choose to mirror that logic inside TCG, then of the 3 possible exits from the block one of them should be LBEG so that the most likely edge can get chained. r~