Revision 57fec1fe target-ppc/translate.c
b/target-ppc/translate.c | ||
---|---|---|
26 | 26 |
#include "cpu.h" |
27 | 27 |
#include "exec-all.h" |
28 | 28 |
#include "disas.h" |
29 |
#include "tcg-op.h" |
|
29 | 30 |
|
30 | 31 |
/* Include definitions for instructions classes and implementations flags */ |
31 | 32 |
//#define DO_SINGLE_STEP |
... | ... | |
36 | 37 |
|
37 | 38 |
/*****************************************************************************/ |
38 | 39 |
/* Code translation helpers */ |
39 |
#if defined(USE_DIRECT_JUMP) |
|
40 |
#define TBPARAM(x) |
|
41 |
#else |
|
42 |
#define TBPARAM(x) (long)(x) |
|
43 |
#endif |
|
44 | 40 |
|
45 |
enum { |
|
46 |
#define DEF(s, n, copy_size) INDEX_op_ ## s, |
|
47 |
#include "opc.h" |
|
48 |
#undef DEF |
|
49 |
NB_OPS, |
|
50 |
}; |
|
51 |
|
|
52 |
static uint16_t *gen_opc_ptr; |
|
53 |
static uint32_t *gen_opparam_ptr; |
|
54 | 41 |
#if defined(OPTIMIZE_FPRF_UPDATE) |
55 | 42 |
static uint16_t *gen_fprf_buf[OPC_BUF_SIZE]; |
56 | 43 |
static uint16_t **gen_fprf_ptr; |
57 | 44 |
#endif |
58 | 45 |
|
59 |
#include "gen-op.h" |
|
60 |
|
|
61 | 46 |
static always_inline void gen_set_T0 (target_ulong val) |
62 | 47 |
{ |
63 | 48 |
#if defined(TARGET_PPC64) |
... | ... | |
2798 | 2783 |
{ |
2799 | 2784 |
TranslationBlock *tb; |
2800 | 2785 |
tb = ctx->tb; |
2801 |
if ((tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK)) { |
|
2802 |
if (n == 0) |
|
2803 |
gen_op_goto_tb0(TBPARAM(tb)); |
|
2804 |
else |
|
2805 |
gen_op_goto_tb1(TBPARAM(tb)); |
|
2786 |
if ((tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK) && |
|
2787 |
!ctx->singlestep_enabled) { |
|
2788 |
tcg_gen_goto_tb(n); |
|
2806 | 2789 |
gen_set_T1(dest); |
2807 | 2790 |
#if defined(TARGET_PPC64) |
2808 | 2791 |
if (ctx->sf_mode) |
... | ... | |
2810 | 2793 |
else |
2811 | 2794 |
#endif |
2812 | 2795 |
gen_op_b_T1(); |
2813 |
gen_op_set_T0((long)tb + n); |
|
2814 |
if (ctx->singlestep_enabled) |
|
2815 |
gen_op_debug(); |
|
2816 |
gen_op_exit_tb(); |
|
2796 |
tcg_gen_exit_tb((long)tb + n); |
|
2817 | 2797 |
} else { |
2818 | 2798 |
gen_set_T1(dest); |
2819 | 2799 |
#if defined(TARGET_PPC64) |
... | ... | |
2822 | 2802 |
else |
2823 | 2803 |
#endif |
2824 | 2804 |
gen_op_b_T1(); |
2825 |
gen_op_reset_T0(); |
|
2826 | 2805 |
if (ctx->singlestep_enabled) |
2827 | 2806 |
gen_op_debug(); |
2828 |
gen_op_exit_tb();
|
|
2807 |
tcg_gen_exit_tb(0);
|
|
2829 | 2808 |
} |
2830 | 2809 |
} |
2831 | 2810 |
|
... | ... | |
2934 | 2913 |
else |
2935 | 2914 |
#endif |
2936 | 2915 |
gen_op_b_T1(); |
2937 |
gen_op_reset_T0(); |
|
2938 | 2916 |
goto no_test; |
2939 | 2917 |
} |
2940 | 2918 |
break; |
... | ... | |
3005 | 2983 |
else |
3006 | 2984 |
#endif |
3007 | 2985 |
gen_op_btest_T1(ctx->nip); |
3008 |
gen_op_reset_T0(); |
|
3009 | 2986 |
no_test: |
3010 | 2987 |
if (ctx->singlestep_enabled) |
3011 | 2988 |
gen_op_debug(); |
3012 |
gen_op_exit_tb();
|
|
2989 |
tcg_gen_exit_tb(0);
|
|
3013 | 2990 |
} |
3014 | 2991 |
out: |
3015 | 2992 |
ctx->exception = POWERPC_EXCP_BRANCH; |
... | ... | |
6176 | 6153 |
int j, lj = -1; |
6177 | 6154 |
|
6178 | 6155 |
pc_start = tb->pc; |
6179 |
gen_opc_ptr = gen_opc_buf; |
|
6180 | 6156 |
gen_opc_end = gen_opc_buf + OPC_MAX_SIZE; |
6181 |
gen_opparam_ptr = gen_opparam_buf; |
|
6182 | 6157 |
#if defined(OPTIMIZE_FPRF_UPDATE) |
6183 | 6158 |
gen_fprf_ptr = gen_fprf_buf; |
6184 | 6159 |
#endif |
6185 |
nb_gen_labels = 0; |
|
6186 | 6160 |
ctx.nip = pc_start; |
6187 | 6161 |
ctx.tb = tb; |
6188 | 6162 |
ctx.exception = POWERPC_EXCP_NONE; |
... | ... | |
6332 | 6306 |
if (ctx.exception == POWERPC_EXCP_NONE) { |
6333 | 6307 |
gen_goto_tb(&ctx, 0, ctx.nip); |
6334 | 6308 |
} else if (ctx.exception != POWERPC_EXCP_BRANCH) { |
6335 |
gen_op_reset_T0(); |
|
6336 | 6309 |
/* Generate the return instruction */ |
6337 |
gen_op_exit_tb();
|
|
6310 |
tcg_gen_exit_tb(0);
|
|
6338 | 6311 |
} |
6339 | 6312 |
*gen_opc_ptr = INDEX_op_end; |
6340 | 6313 |
if (unlikely(search_pc)) { |
... | ... | |
6358 | 6331 |
target_disas(logfile, pc_start, ctx.nip - pc_start, flags); |
6359 | 6332 |
fprintf(logfile, "\n"); |
6360 | 6333 |
} |
6361 |
if (loglevel & CPU_LOG_TB_OP) { |
|
6362 |
fprintf(logfile, "OP:\n"); |
|
6363 |
dump_ops(gen_opc_buf, gen_opparam_buf); |
|
6364 |
fprintf(logfile, "\n"); |
|
6365 |
} |
|
6366 | 6334 |
#endif |
6367 | 6335 |
return 0; |
6368 | 6336 |
} |
Also available in: Unified diff