summaryrefslogtreecommitdiff
path: root/target-ppc/translate.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2008-02-01 10:50:11 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2008-02-01 10:50:11 +0000
commit57fec1fee94aa9f7d2519e8c354f100fc36bc9fa (patch)
treedd3381d7ab3c77532719ea9366782b27f09bfc87 /target-ppc/translate.c
parentc896fe29d6c8ae6cde3917727812ced3f2e536a4 (diff)
downloadqemu-57fec1fee94aa9f7d2519e8c354f100fc36bc9fa.tar.gz
use the TCG code generator
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3944 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-ppc/translate.c')
-rw-r--r--target-ppc/translate.c48
1 files changed, 8 insertions, 40 deletions
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index 1313a77362..c9530eb17e 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -26,6 +26,7 @@
#include "cpu.h"
#include "exec-all.h"
#include "disas.h"
+#include "tcg-op.h"
/* Include definitions for instructions classes and implementations flags */
//#define DO_SINGLE_STEP
@@ -36,28 +37,12 @@
/*****************************************************************************/
/* Code translation helpers */
-#if defined(USE_DIRECT_JUMP)
-#define TBPARAM(x)
-#else
-#define TBPARAM(x) (long)(x)
-#endif
-enum {
-#define DEF(s, n, copy_size) INDEX_op_ ## s,
-#include "opc.h"
-#undef DEF
- NB_OPS,
-};
-
-static uint16_t *gen_opc_ptr;
-static uint32_t *gen_opparam_ptr;
#if defined(OPTIMIZE_FPRF_UPDATE)
static uint16_t *gen_fprf_buf[OPC_BUF_SIZE];
static uint16_t **gen_fprf_ptr;
#endif
-#include "gen-op.h"
-
static always_inline void gen_set_T0 (target_ulong val)
{
#if defined(TARGET_PPC64)
@@ -2798,11 +2783,9 @@ static always_inline void gen_goto_tb (DisasContext *ctx, int n,
{
TranslationBlock *tb;
tb = ctx->tb;
- if ((tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK)) {
- if (n == 0)
- gen_op_goto_tb0(TBPARAM(tb));
- else
- gen_op_goto_tb1(TBPARAM(tb));
+ if ((tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK) &&
+ !ctx->singlestep_enabled) {
+ tcg_gen_goto_tb(n);
gen_set_T1(dest);
#if defined(TARGET_PPC64)
if (ctx->sf_mode)
@@ -2810,10 +2793,7 @@ static always_inline void gen_goto_tb (DisasContext *ctx, int n,
else
#endif
gen_op_b_T1();
- gen_op_set_T0((long)tb + n);
- if (ctx->singlestep_enabled)
- gen_op_debug();
- gen_op_exit_tb();
+ tcg_gen_exit_tb((long)tb + n);
} else {
gen_set_T1(dest);
#if defined(TARGET_PPC64)
@@ -2822,10 +2802,9 @@ static always_inline void gen_goto_tb (DisasContext *ctx, int n,
else
#endif
gen_op_b_T1();
- gen_op_reset_T0();
if (ctx->singlestep_enabled)
gen_op_debug();
- gen_op_exit_tb();
+ tcg_gen_exit_tb(0);
}
}
@@ -2934,7 +2913,6 @@ static always_inline void gen_bcond (DisasContext *ctx, int type)
else
#endif
gen_op_b_T1();
- gen_op_reset_T0();
goto no_test;
}
break;
@@ -3005,11 +2983,10 @@ static always_inline void gen_bcond (DisasContext *ctx, int type)
else
#endif
gen_op_btest_T1(ctx->nip);
- gen_op_reset_T0();
no_test:
if (ctx->singlestep_enabled)
gen_op_debug();
- gen_op_exit_tb();
+ tcg_gen_exit_tb(0);
}
out:
ctx->exception = POWERPC_EXCP_BRANCH;
@@ -6176,13 +6153,10 @@ static always_inline int gen_intermediate_code_internal (CPUState *env,
int j, lj = -1;
pc_start = tb->pc;
- gen_opc_ptr = gen_opc_buf;
gen_opc_end = gen_opc_buf + OPC_MAX_SIZE;
- gen_opparam_ptr = gen_opparam_buf;
#if defined(OPTIMIZE_FPRF_UPDATE)
gen_fprf_ptr = gen_fprf_buf;
#endif
- nb_gen_labels = 0;
ctx.nip = pc_start;
ctx.tb = tb;
ctx.exception = POWERPC_EXCP_NONE;
@@ -6332,9 +6306,8 @@ static always_inline int gen_intermediate_code_internal (CPUState *env,
if (ctx.exception == POWERPC_EXCP_NONE) {
gen_goto_tb(&ctx, 0, ctx.nip);
} else if (ctx.exception != POWERPC_EXCP_BRANCH) {
- gen_op_reset_T0();
/* Generate the return instruction */
- gen_op_exit_tb();
+ tcg_gen_exit_tb(0);
}
*gen_opc_ptr = INDEX_op_end;
if (unlikely(search_pc)) {
@@ -6358,11 +6331,6 @@ static always_inline int gen_intermediate_code_internal (CPUState *env,
target_disas(logfile, pc_start, ctx.nip - pc_start, flags);
fprintf(logfile, "\n");
}
- if (loglevel & CPU_LOG_TB_OP) {
- fprintf(logfile, "OP:\n");
- dump_ops(gen_opc_buf, gen_opparam_buf);
- fprintf(logfile, "\n");
- }
#endif
return 0;
}