summaryrefslogtreecommitdiff
path: root/target-ppc
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
parentc896fe29d6c8ae6cde3917727812ced3f2e536a4 (diff)
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')
-rw-r--r--target-ppc/op.c15
-rw-r--r--target-ppc/translate.c48
2 files changed, 8 insertions, 55 deletions
diff --git a/target-ppc/op.c b/target-ppc/op.c
index c950579a1b..6cda0f0f64 100644
--- a/target-ppc/op.c
+++ b/target-ppc/op.c
@@ -222,11 +222,6 @@ void OPPROTO op_debug (void)
do_raise_exception(EXCP_DEBUG);
}
-void OPPROTO op_exit_tb (void)
-{
- EXIT_TB();
-}
-
/* Load/store special registers */
void OPPROTO op_load_cr (void)
{
@@ -674,16 +669,6 @@ void OPPROTO op_setlr_64 (void)
}
#endif
-void OPPROTO op_goto_tb0 (void)
-{
- GOTO_TB(op_goto_tb0, PARAM1, 0);
-}
-
-void OPPROTO op_goto_tb1 (void)
-{
- GOTO_TB(op_goto_tb1, PARAM1, 1);
-}
-
void OPPROTO op_b_T1 (void)
{
env->nip = (uint32_t)(T1 & ~3);
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;
}