gen_intermediate_code_internal(MoxieCPU *cpu, TranslationBlock *tb,

                               bool search_pc)

{

    CPUState *cs = CPU(cpu);

    DisasContext ctx;

    target_ulong pc_start;

    uint16_t *gen_opc_end;

    CPUBreakpoint *bp;

    int j, lj = -1;

    CPUMoxieState *env = &cpu->env;

    int num_insns;



    pc_start = tb->pc;

    gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE;

    ctx.pc = pc_start;

    ctx.saved_pc = -1;

    ctx.tb = tb;

    ctx.memidx = 0;

    ctx.singlestep_enabled = 0;

    ctx.bstate = BS_NONE;

    num_insns = 0;



    gen_tb_start();

    do {

        if (unlikely(!QTAILQ_EMPTY(&cs->breakpoints))) {

            QTAILQ_FOREACH(bp, &cs->breakpoints, entry) {

                if (ctx.pc == bp->pc) {

                    tcg_gen_movi_i32(cpu_pc, ctx.pc);

                    gen_helper_debug(cpu_env);

                    ctx.bstate = BS_EXCP;

                    goto done_generating;

                }

            }

        }



        if (search_pc) {

            j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;

            if (lj < j) {

                lj++;

                while (lj < j) {

                    tcg_ctx.gen_opc_instr_start[lj++] = 0;

                }

            }

            tcg_ctx.gen_opc_pc[lj] = ctx.pc;

            tcg_ctx.gen_opc_instr_start[lj] = 1;

            tcg_ctx.gen_opc_icount[lj] = num_insns;

        }

        ctx.opcode = cpu_lduw_code(env, ctx.pc);

        ctx.pc += decode_opc(cpu, &ctx);

        num_insns++;



        if (cs->singlestep_enabled) {

            break;

        }



        if ((ctx.pc & (TARGET_PAGE_SIZE - 1)) == 0) {

            break;

        }

    } while (ctx.bstate == BS_NONE && tcg_ctx.gen_opc_ptr < gen_opc_end);



    if (cs->singlestep_enabled) {

        tcg_gen_movi_tl(cpu_pc, ctx.pc);

        gen_helper_debug(cpu_env);

    } else {

        switch (ctx.bstate) {

        case BS_STOP:

        case BS_NONE:

            gen_goto_tb(env, &ctx, 0, ctx.pc);

            break;

        case BS_EXCP:

            tcg_gen_exit_tb(0);

            break;

        case BS_BRANCH:

        default:

            break;

        }

    }

 done_generating:

    gen_tb_end(tb, num_insns);

    *tcg_ctx.gen_opc_ptr = INDEX_op_end;

    if (search_pc) {

        j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;

        lj++;

        while (lj <= j) {

            tcg_ctx.gen_opc_instr_start[lj++] = 0;

        }

    } else {

        tb->size = ctx.pc - pc_start;

        tb->icount = num_insns;

    }

}

gen_intermediate_code_internal(MoxieCPU *cpu, TranslationBlock *tb,

                               bool search_pc)

{

    CPUState *cs = CPU(cpu);

    DisasContext ctx;

    target_ulong pc_start;

    uint16_t *gen_opc_end;

    CPUBreakpoint *bp;

    int j, lj = -1;

    CPUMoxieState *env = &cpu->env;

    int num_insns;



    pc_start = tb->pc;

    gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE;

    ctx.pc = pc_start;

    ctx.saved_pc = -1;

    ctx.tb = tb;

    ctx.memidx = 0;

    ctx.singlestep_enabled = 0;

    ctx.bstate = BS_NONE;

    num_insns = 0;



    gen_tb_start();

    do {

        if (unlikely(!QTAILQ_EMPTY(&cs->breakpoints))) {

            QTAILQ_FOREACH(bp, &cs->breakpoints, entry) {

                if (ctx.pc == bp->pc) {

                    tcg_gen_movi_i32(cpu_pc, ctx.pc);

                    gen_helper_debug(cpu_env);

                    ctx.bstate = BS_EXCP;

                    goto done_generating;

                }

            }

        }



        if (search_pc) {

            j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;

            if (lj < j) {

                lj++;

                while (lj < j) {

                    tcg_ctx.gen_opc_instr_start[lj++] = 0;

                }

            }

            tcg_ctx.gen_opc_pc[lj] = ctx.pc;

            tcg_ctx.gen_opc_instr_start[lj] = 1;

            tcg_ctx.gen_opc_icount[lj] = num_insns;

        }

        ctx.opcode = cpu_lduw_code(env, ctx.pc);

        ctx.pc += decode_opc(cpu, &ctx);

        num_insns++;



        if (cs->singlestep_enabled) {

            break;

        }



        if ((ctx.pc & (TARGET_PAGE_SIZE - 1)) == 0) {

            break;

        }

    } while (ctx.bstate == BS_NONE && tcg_ctx.gen_opc_ptr < gen_opc_end);



    if (cs->singlestep_enabled) {

        tcg_gen_movi_tl(cpu_pc, ctx.pc);

        gen_helper_debug(cpu_env);

    } else {

        switch (ctx.bstate) {

        case BS_STOP:

        case BS_NONE:

            gen_goto_tb(env, &ctx, 0, ctx.pc);

            break;

        case BS_EXCP:

            tcg_gen_exit_tb(0);

            break;

        case BS_BRANCH:

        default:

            break;

        }

    }

 done_generating:

    gen_tb_end(tb, num_insns);

    *tcg_ctx.gen_opc_ptr = INDEX_op_end;

    if (search_pc) {

        j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;

        lj++;

        while (lj <= j) {

            tcg_ctx.gen_opc_instr_start[lj++] = 0;

        }

    } else {

        tb->size = ctx.pc - pc_start;

        tb->icount = num_insns;

    }

}

FUNC_0(MoxieCPU *VAR_0, TranslationBlock *VAR_1,

                               bool VAR_2)

{

    CPUState *cs = CPU(VAR_0);

    DisasContext ctx;

    target_ulong pc_start;

    uint16_t *gen_opc_end;

    CPUBreakpoint *bp;

    int VAR_3, VAR_4 = -1;

    CPUMoxieState *env = &VAR_0->env;

    int VAR_5;



    pc_start = VAR_1->pc;

    gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE;

    ctx.pc = pc_start;

    ctx.saved_pc = -1;

    ctx.VAR_1 = VAR_1;

    ctx.memidx = 0;

    ctx.singlestep_enabled = 0;

    ctx.bstate = BS_NONE;

    VAR_5 = 0;



    gen_tb_start();

    do {

        if (unlikely(!QTAILQ_EMPTY(&cs->breakpoints))) {

            QTAILQ_FOREACH(bp, &cs->breakpoints, entry) {

                if (ctx.pc == bp->pc) {

                    tcg_gen_movi_i32(cpu_pc, ctx.pc);

                    gen_helper_debug(cpu_env);

                    ctx.bstate = BS_EXCP;

                    goto done_generating;

                }

            }

        }



        if (VAR_2) {

            VAR_3 = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;

            if (VAR_4 < VAR_3) {

                VAR_4++;

                while (VAR_4 < VAR_3) {

                    tcg_ctx.gen_opc_instr_start[VAR_4++] = 0;

                }

            }

            tcg_ctx.gen_opc_pc[VAR_4] = ctx.pc;

            tcg_ctx.gen_opc_instr_start[VAR_4] = 1;

            tcg_ctx.gen_opc_icount[VAR_4] = VAR_5;

        }

        ctx.opcode = cpu_lduw_code(env, ctx.pc);

        ctx.pc += decode_opc(VAR_0, &ctx);

        VAR_5++;



        if (cs->singlestep_enabled) {

            break;

        }



        if ((ctx.pc & (TARGET_PAGE_SIZE - 1)) == 0) {

            break;

        }

    } while (ctx.bstate == BS_NONE && tcg_ctx.gen_opc_ptr < gen_opc_end);



    if (cs->singlestep_enabled) {

        tcg_gen_movi_tl(cpu_pc, ctx.pc);

        gen_helper_debug(cpu_env);

    } else {

        switch (ctx.bstate) {

        case BS_STOP:

        case BS_NONE:

            gen_goto_tb(env, &ctx, 0, ctx.pc);

            break;

        case BS_EXCP:

            tcg_gen_exit_tb(0);

            break;

        case BS_BRANCH:

        default:

            break;

        }

    }

 done_generating:

    gen_tb_end(VAR_1, VAR_5);

    *tcg_ctx.gen_opc_ptr = INDEX_op_end;

    if (VAR_2) {

        VAR_3 = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;

        VAR_4++;

        while (VAR_4 <= VAR_3) {

            tcg_ctx.gen_opc_instr_start[VAR_4++] = 0;

        }

    } else {

        VAR_1->size = ctx.pc - pc_start;

        VAR_1->icount = VAR_5;

    }

}

FUNC_0(MoxieCPU *VAR_0, TranslationBlock *VAR_1,
bool VAR_2)
{ CPUState *cs = CPU(VAR_0); DisasContext ctx; target_ulong pc_start; uint16_t *gen_opc_end; CPUBreakpoint *bp; int VAR_3, VAR_4 = -1; CPUMoxieState *env = &VAR_0->env; int VAR_5; pc_start = VAR_1->pc; gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE; ctx.pc = pc_start; ctx.saved_pc = -1; ctx.VAR_1 = VAR_1; ctx.memidx = 0; ctx.singlestep_enabled = 0; ctx.bstate = BS_NONE; VAR_5 = 0; gen_tb_start(); do { if (unlikely(!QTAILQ_EMPTY(&cs->breakpoints))) { QTAILQ_FOREACH(bp, &cs->breakpoints, entry) { if (ctx.pc == bp->pc) { tcg_gen_movi_i32(cpu_pc, ctx.pc); gen_helper_debug(cpu_env); ctx.bstate = BS_EXCP; goto done_generating; } } } if (VAR_2) { VAR_3 = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; if (VAR_4 < VAR_3) { VAR_4++; while (VAR_4 < VAR_3) { tcg_ctx.gen_opc_instr_start[VAR_4++] = 0; } } tcg_ctx.gen_opc_pc[VAR_4] = ctx.pc; tcg_ctx.gen_opc_instr_start[VAR_4] = 1; tcg_ctx.gen_opc_icount[VAR_4] = VAR_5; } ctx.opcode = cpu_lduw_code(env, ctx.pc); ctx.pc += decode_opc(VAR_0, &ctx); VAR_5++; if (cs->singlestep_enabled) { break; } if ((ctx.pc & (TARGET_PAGE_SIZE - 1)) == 0) { break; } } while (ctx.bstate == BS_NONE && tcg_ctx.gen_opc_ptr < gen_opc_end); if (cs->singlestep_enabled) { tcg_gen_movi_tl(cpu_pc, ctx.pc); gen_helper_debug(cpu_env); } else { switch (ctx.bstate) { case BS_STOP:
case BS_NONE:
gen_goto_tb(env, &ctx, 0, ctx.pc); break; case BS_EXCP:
tcg_gen_exit_tb(0); break; case BS_BRANCH:
default:
break; } } done_generating:
gen_tb_end(VAR_1, VAR_5); *tcg_ctx.gen_opc_ptr = INDEX_op_end; if (VAR_2) { VAR_3 = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; VAR_4++; while (VAR_4 <= VAR_3) { tcg_ctx.gen_opc_instr_start[VAR_4++] = 0; } } else { VAR_1->size = ctx.pc - pc_start; VAR_1->icount = VAR_5; } }