* [Qemu-devel] [5112] SH4: convert a few helpers to TCG
@ 2008-08-29 23:01 Aurelien Jarno
2008-08-30 5:06 ` Blue Swirl
0 siblings, 1 reply; 2+ messages in thread
From: Aurelien Jarno @ 2008-08-29 23:01 UTC (permalink / raw)
To: qemu-devel
Revision: 5112
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5112
Author: aurel32
Date: 2008-08-29 23:01:41 +0000 (Fri, 29 Aug 2008)
Log Message:
-----------
SH4: convert a few helpers to TCG
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Modified Paths:
--------------
trunk/target-sh4/helper.h
trunk/target-sh4/op.c
trunk/target-sh4/op_helper.c
trunk/target-sh4/translate.c
Modified: trunk/target-sh4/helper.h
===================================================================
--- trunk/target-sh4/helper.h 2008-08-29 22:32:32 UTC (rev 5111)
+++ trunk/target-sh4/helper.h 2008-08-29 23:01:41 UTC (rev 5112)
@@ -2,3 +2,9 @@
#define DEF_HELPER(ret, name, params) ret name params;
#endif
+DEF_HELPER(void, helper_ldtlb, (void))
+DEF_HELPER(void, helper_raise_illegal_instruction, (void))
+DEF_HELPER(void, helper_raise_slot_illegal_instruction, (void))
+DEF_HELPER(void, helper_debug, (void))
+DEF_HELPER(void, helper_sleep, (void))
+DEF_HELPER(void, helper_trapa, (uint32_t))
Modified: trunk/target-sh4/op.c
===================================================================
--- trunk/target-sh4/op.c 2008-08-29 22:32:32 UTC (rev 5111)
+++ trunk/target-sh4/op.c 2008-08-29 23:01:41 UTC (rev 5112)
@@ -37,12 +37,6 @@
clr_t();
}
-void OPPROTO op_ldtlb(void)
-{
- helper_ldtlb();
- RETURN();
-}
-
void OPPROTO op_frchg(void)
{
env->fpscr ^= FPSCR_FR;
@@ -178,14 +172,6 @@
RETURN();
}
-void OPPROTO op_trapa(void)
-{
- env->tra = PARAM1 << 2;
- env->exception_index = 0x160;
- do_raise_exception();
- RETURN();
-}
-
void OPPROTO op_ldcl_rMplus_rN_bank(void)
{
env->gregs[PARAM2] = env->gregs[PARAM1];
@@ -491,33 +477,6 @@
RETURN();
}
-void OPPROTO op_raise_illegal_instruction(void)
-{
- env->exception_index = 0x180;
- do_raise_exception();
- RETURN();
-}
-
-void OPPROTO op_raise_slot_illegal_instruction(void)
-{
- env->exception_index = 0x1a0;
- do_raise_exception();
- RETURN();
-}
-
-void OPPROTO op_debug(void)
-{
- env->exception_index = EXCP_DEBUG;
- cpu_loop_exit();
-}
-
-void OPPROTO op_sleep(void)
-{
- env->halted = 1;
- env->exception_index = EXCP_HLT;
- cpu_loop_exit();
-}
-
/* Load and store */
#define MEMSUFFIX _raw
#include "op_mem.c"
Modified: trunk/target-sh4/op_helper.c
===================================================================
--- trunk/target-sh4/op_helper.c 2008-08-29 22:32:32 UTC (rev 5111)
+++ trunk/target-sh4/op_helper.c 2008-08-29 23:01:41 UTC (rev 5112)
@@ -20,11 +20,6 @@
#include <assert.h>
#include "exec.h"
-void do_raise_exception(void)
-{
- cpu_loop_exit();
-}
-
#ifndef CONFIG_USER_ONLY
#define MMUSUFFIX _mmu
@@ -64,7 +59,7 @@
cpu_restore_state(tb, env, pc, NULL);
}
}
- do_raise_exception();
+ cpu_loop_exit();
}
env = saved_env;
}
@@ -81,6 +76,38 @@
#endif
}
+void helper_raise_illegal_instruction(void)
+{
+ env->exception_index = 0x180;
+ cpu_loop_exit();
+}
+
+void helper_raise_slot_illegal_instruction(void)
+{
+ env->exception_index = 0x1a0;
+ cpu_loop_exit();
+}
+
+void helper_debug(void)
+{
+ env->exception_index = EXCP_DEBUG;
+ cpu_loop_exit();
+}
+
+void helper_sleep(void)
+{
+ env->halted = 1;
+ env->exception_index = EXCP_HLT;
+ cpu_loop_exit();
+}
+
+void helper_trapa(uint32_t tra)
+{
+ env->tra = tra << 2;
+ env->exception_index = 0x160;
+ cpu_loop_exit();
+}
+
void helper_addc_T0_T1(void)
{
uint32_t tmp0, tmp1;
Modified: trunk/target-sh4/translate.c
===================================================================
--- trunk/target-sh4/translate.c 2008-08-29 22:32:32 UTC (rev 5111)
+++ trunk/target-sh4/translate.c 2008-08-29 23:01:41 UTC (rev 5112)
@@ -248,7 +248,7 @@
} else {
tcg_gen_movi_i32(cpu_pc, dest);
if (ctx->singlestep_enabled)
- gen_op_debug();
+ tcg_gen_helper_0_0(helper_debug);
tcg_gen_exit_tb(0);
}
}
@@ -260,7 +260,7 @@
delayed jump as immediate jump are conditinal jumps */
tcg_gen_mov_i32(cpu_pc, cpu_delayed_pc);
if (ctx->singlestep_enabled)
- gen_op_debug();
+ tcg_gen_helper_0_0(helper_debug);
tcg_gen_exit_tb(0);
} else {
gen_goto_tb(ctx, 0, ctx->delayed_pc);
@@ -368,7 +368,7 @@
#define CHECK_NOT_DELAY_SLOT \
if (ctx->flags & (DELAY_SLOT | DELAY_SLOT_CONDITIONAL)) \
- {gen_op_raise_slot_illegal_instruction (); ctx->bstate = BS_EXCP; \
+ {tcg_gen_helper_0_0(helper_raise_slot_illegal_instruction); ctx->bstate = BS_EXCP; \
return;}
void _decode_opc(DisasContext * ctx)
@@ -400,7 +400,7 @@
#if defined(CONFIG_USER_ONLY)
assert(0); /* XXXXX */
#else
- gen_op_ldtlb();
+ tcg_gen_helper_0_0(helper_ldtlb);
#endif
return;
case 0x002b: /* rte */
@@ -428,9 +428,9 @@
return;
case 0x001b: /* sleep */
if (ctx->memidx) {
- gen_op_sleep();
+ tcg_gen_helper_0_0(helper_sleep);
} else {
- gen_op_raise_illegal_instruction();
+ tcg_gen_helper_0_0(helper_raise_illegal_instruction);
ctx->bstate = BS_EXCP;
}
return;
@@ -1060,8 +1060,10 @@
gen_op_stb_T0_T1(ctx);
return;
case 0xc300: /* trapa #imm */
- CHECK_NOT_DELAY_SLOT tcg_gen_movi_i32(cpu_pc, ctx->pc);
- gen_op_trapa(B7_0);
+ CHECK_NOT_DELAY_SLOT
+ tcg_gen_movi_i32(cpu_pc, ctx->pc);
+ tcg_gen_movi_i32(cpu_T[0], B7_0);
+ tcg_gen_helper_0_1(helper_trapa, cpu_T[0]);
ctx->bstate = BS_BRANCH;
return;
case 0xc800: /* tst #imm,R0 */
@@ -1355,7 +1357,7 @@
fprintf(stderr, "unknown instruction 0x%04x at pc 0x%08x\n",
ctx->opcode, ctx->pc);
- gen_op_raise_illegal_instruction();
+ tcg_gen_helper_0_0(helper_raise_illegal_instruction);
ctx->bstate = BS_EXCP;
}
@@ -1434,7 +1436,7 @@
if (ctx.pc == env->breakpoints[i]) {
/* We have hit a breakpoint - make sure PC is up-to-date */
tcg_gen_movi_i32(cpu_pc, ctx.pc);
- gen_op_debug();
+ tcg_gen_helper_0_0(helper_debug);
ctx.bstate = BS_EXCP;
break;
}
@@ -1475,7 +1477,7 @@
if (tb->cflags & CF_LAST_IO)
gen_io_end();
if (env->singlestep_enabled) {
- gen_op_debug();
+ tcg_gen_helper_0_0(helper_debug);
} else {
switch (ctx.bstate) {
case BS_STOP:
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [5112] SH4: convert a few helpers to TCG
2008-08-29 23:01 [Qemu-devel] [5112] SH4: convert a few helpers to TCG Aurelien Jarno
@ 2008-08-30 5:06 ` Blue Swirl
0 siblings, 0 replies; 2+ messages in thread
From: Blue Swirl @ 2008-08-30 5:06 UTC (permalink / raw)
To: qemu-devel
On Sat, Aug 30, 2008 at 2:01 AM, Aurelien Jarno <aurelien@aurel32.net> wrote:
> case 0xc300: /* trapa #imm */
> - CHECK_NOT_DELAY_SLOT tcg_gen_movi_i32(cpu_pc, ctx->pc);
> - gen_op_trapa(B7_0);
> + CHECK_NOT_DELAY_SLOT
> + tcg_gen_movi_i32(cpu_pc, ctx->pc);
> + tcg_gen_movi_i32(cpu_T[0], B7_0);
> + tcg_gen_helper_0_1(helper_trapa, cpu_T[0]);
Instead of introducing new uses of cpu_T[0], which you will probably
eliminate in the end of conversion, you could pass B7_0 using a
tcg_const temporary variable.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-08-30 5:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-29 23:01 [Qemu-devel] [5112] SH4: convert a few helpers to TCG Aurelien Jarno
2008-08-30 5:06 ` Blue Swirl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).