On 05/03/2011 05:59 PM, Max Filippov wrote:
> +                int label = gen_new_label();
> +                int inv = BRI12_M & 1;
> +
> +                switch (BRI12_M & 2) {
> +                case 0: /*BEQZ*/
> +                    tcg_gen_brcondi_i32(inv ? TCG_COND_EQ : TCG_COND_NE,
> +                            cpu_R[BRI12_S], 0, label);
> +                    break;
> +
> +                case 2: /*BLTZ*/
> +                    tcg_gen_brcondi_i32(inv ? TCG_COND_LT : TCG_COND_GE,
> +                            cpu_R[BRI12_S], 0, label);
> +                    break;
> +                }
> +                gen_jumpi(dc, dc->pc + 4 + BRI12_IMM12_SE);
> +                gen_set_label(label);
> +                gen_jumpi(dc, dc->pc + 3);

It seems to me that this code could be cleaned up by extracting
the branching and jumpi'ing into a function.  There's a lot of
repetition here.

Also, once you do get around to using chained TB's, there'll be
only one place to have to update to get that to happen.


r~

Reply via email to