diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2005-10-30 21:39:19 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2005-10-30 21:39:19 +0000 |
commit | c53be3347484b0f73deebcfa2e5faf538d6fa7c0 (patch) | |
tree | 6f996e28668f34c6496991c55a08dd5a32becf4e /target-ppc | |
parent | d5d11eac6c853d10a9d97a279f1c69e0f0d66397 (diff) |
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')
-rw-r--r-- | target-ppc/op.c | 18 | ||||
-rw-r--r-- | target-ppc/translate.c | 31 |
2 files changed, 37 insertions, 12 deletions
diff --git a/target-ppc/op.c b/target-ppc/op.c index 0e37119dac..4b0af5587c 100644 --- a/target-ppc/op.c +++ b/target-ppc/op.c @@ -451,9 +451,14 @@ PPC_OP(setlr) regs->lr = PARAM1; } -PPC_OP(b) +PPC_OP(goto_tb0) { - JUMP_TB(b1, PARAM1, 0, PARAM2); + GOTO_TB(op_goto_tb0, PARAM1, 0); +} + +PPC_OP(goto_tb1) +{ + GOTO_TB(op_goto_tb1, PARAM1, 1); } PPC_OP(b_T1) @@ -461,13 +466,10 @@ PPC_OP(b_T1) regs->nip = T1 & ~3; } -PPC_OP(btest) +PPC_OP(jz_T0) { - if (T0) { - JUMP_TB(btest, PARAM1, 0, PARAM2); - } else { - JUMP_TB(btest, PARAM1, 1, PARAM3); - } + if (!T0) + GOTO_LABEL_PARAM(1); RETURN(); } diff --git a/target-ppc/translate.c b/target-ppc/translate.c index 70f88637df..c04c0ef99a 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); } |