aboutsummaryrefslogtreecommitdiff
path: root/target-ppc/translate.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2005-10-30 21:39:19 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2005-10-30 21:39:19 +0000
commitc53be3347484b0f73deebcfa2e5faf538d6fa7c0 (patch)
tree6f996e28668f34c6496991c55a08dd5a32becf4e /target-ppc/translate.c
parentd5d11eac6c853d10a9d97a279f1c69e0f0d66397 (diff)
downloadqemu-c53be3347484b0f73deebcfa2e5faf538d6fa7c0.zip
qemu-c53be3347484b0f73deebcfa2e5faf538d6fa7c0.tar.gz
qemu-c53be3347484b0f73deebcfa2e5faf538d6fa7c0.tar.bz2
suppressed JUMP_TB (Paul Brook)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1594 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-ppc/translate.c')
-rw-r--r--target-ppc/translate.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index 70f8863..c04c0ef 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -30,6 +30,12 @@
//#define DO_SINGLE_STEP
//#define PPC_DEBUG_DISAS
+#ifdef 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"
@@ -1721,6 +1727,18 @@ GEN_HANDLER(stfiwx, 0x1F, 0x17, 0x1E, 0x00000001, PPC_FLOAT)
/*** Branch ***/
+static inline void gen_jmp_tb(long tb, int n, uint32_t dest)
+{
+ if (n == 0)
+ gen_op_goto_tb0(TBPARAM(tb));
+ else
+ gen_op_goto_tb1(TBPARAM(tb));
+ gen_op_set_T1(dest);
+ gen_op_b_T1();
+ gen_op_set_T0(tb + n);
+ gen_op_exit_tb();
+}
+
/* b ba bl bla */
GEN_HANDLER(b, 0x12, 0xFF, 0xFF, 0x00000000, PPC_FLOW)
{
@@ -1736,7 +1754,7 @@ GEN_HANDLER(b, 0x12, 0xFF, 0xFF, 0x00000000, PPC_FLOW)
if (LK(ctx->opcode)) {
gen_op_setlr(ctx->nip);
}
- gen_op_b((long)ctx->tb, target);
+ gen_jmp_tb((long)ctx->tb, 0, target);
ctx->exception = EXCP_BRANCH;
}
@@ -1787,7 +1805,7 @@ static inline void gen_bcond(DisasContext *ctx, int type)
case 4:
case 6:
if (type == BCOND_IM) {
- gen_op_b((long)ctx->tb, target);
+ gen_jmp_tb((long)ctx->tb, 0, target);
} else {
gen_op_b_T1();
}
@@ -1827,7 +1845,11 @@ static inline void gen_bcond(DisasContext *ctx, int type)
}
}
if (type == BCOND_IM) {
- gen_op_btest((long)ctx->tb, target, ctx->nip);
+ int l1 = gen_new_label();
+ gen_op_jz_T0(l1);
+ gen_jmp_tb((long)ctx->tb, 0, target);
+ gen_set_label(l1);
+ gen_jmp_tb((long)ctx->tb, 1, ctx->nip);
} else {
gen_op_btest_T1(ctx->nip);
}
@@ -2459,6 +2481,7 @@ int gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb,
gen_opc_ptr = gen_opc_buf;
gen_opc_end = gen_opc_buf + OPC_MAX_SIZE;
gen_opparam_ptr = gen_opparam_buf;
+ nb_gen_labels = 0;
ctx.nip = pc_start;
ctx.tb = tb;
ctx.exception = EXCP_NONE;
@@ -2575,7 +2598,7 @@ int gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb,
#endif
}
if (ctx.exception == EXCP_NONE) {
- gen_op_b((unsigned long)ctx.tb, ctx.nip);
+ gen_jmp_tb((long)ctx.tb, 0, ctx.nip);
} else if (ctx.exception != EXCP_BRANCH) {
gen_op_set_T0(0);
}