Revision 2e70f6ef target-m68k/translate.c

b/target-m68k/translate.c
63 63
/* Used to distinguish stores from bad addressing modes.  */
64 64
static TCGv store_dummy;
65 65

  
66
#include "gen-icount.h"
67

  
66 68
void m68k_tcg_init(void)
67 69
{
68 70
    char *p;
......
2919 2921
    target_ulong pc_start;
2920 2922
    int pc_offset;
2921 2923
    int last_cc_op;
2924
    int num_insns;
2925
    int max_insns;
2922 2926

  
2923 2927
    /* generate intermediate code */
2924 2928
    pc_start = tb->pc;
......
2937 2941
    dc->is_mem = 0;
2938 2942
    dc->mactmp = NULL_QREG;
2939 2943
    lj = -1;
2944
    num_insns = 0;
2945
    max_insns = tb->cflags & CF_COUNT_MASK;
2946
    if (max_insns == 0)
2947
        max_insns = CF_COUNT_MASK;
2948

  
2949
    gen_icount_start();
2940 2950
    do {
2941 2951
        pc_offset = dc->pc - pc_start;
2942 2952
        gen_throws_exception = NULL;
......
2960 2970
            }
2961 2971
            gen_opc_pc[lj] = dc->pc;
2962 2972
            gen_opc_instr_start[lj] = 1;
2973
            gen_opc_icount[lj] = num_insns;
2963 2974
        }
2975
        if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO))
2976
            gen_io_start();
2964 2977
        last_cc_op = dc->cc_op;
2965 2978
        dc->insn_pc = dc->pc;
2966 2979
	disas_m68k_insn(env, dc);
2980
        num_insns++;
2967 2981

  
2968 2982
        /* Terminate the TB on memory ops if watchpoints are present.  */
2969 2983
        /* FIXME: This should be replacd by the deterministic execution
......
2972 2986
            break;
2973 2987
    } while (!dc->is_jmp && gen_opc_ptr < gen_opc_end &&
2974 2988
             !env->singlestep_enabled &&
2975
             (pc_offset) < (TARGET_PAGE_SIZE - 32));
2989
             (pc_offset) < (TARGET_PAGE_SIZE - 32) &&
2990
             num_insns < max_insns);
2976 2991

  
2992
    if (tb->cflags & CF_LAST_IO)
2993
        gen_io_end();
2977 2994
    if (__builtin_expect(env->singlestep_enabled, 0)) {
2978 2995
        /* Make sure the pc is updated, and raise a debug exception.  */
2979 2996
        if (!dc->is_jmp) {
......
2999 3016
            break;
3000 3017
        }
3001 3018
    }
3019
    gen_icount_end(tb, num_insns);
3002 3020
    *gen_opc_ptr = INDEX_op_end;
3003 3021

  
3004 3022
#ifdef DEBUG_DISAS
......
3016 3034
            gen_opc_instr_start[lj++] = 0;
3017 3035
    } else {
3018 3036
        tb->size = dc->pc - pc_start;
3037
        tb->icount = num_insns;
3019 3038
    }
3020 3039

  
3021 3040
    //optimize_flags();

Also available in: Unified diff