aboutsummaryrefslogtreecommitdiff
path: root/target/xtensa
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2019-02-11 02:00:06 -0800
committerMax Filippov <jcmvbkbc@gmail.com>2019-02-11 02:08:14 -0800
commit9791e7e91819468fa4009809fd340575f3fd3d12 (patch)
tree0305487821209902a2f84101695eaba564502acf /target/xtensa
parentfe7869d69caeb0d77b75d14051a6e72a6a10aa76 (diff)
downloadqemu-9791e7e91819468fa4009809fd340575f3fd3d12.zip
qemu-9791e7e91819468fa4009809fd340575f3fd3d12.tar.gz
qemu-9791e7e91819468fa4009809fd340575f3fd3d12.tar.bz2
target/xtensa: get rid of gen_callw[i]
Merge gen_callwi and gen_callw into their only users, translate_callw and translate_callxw. Extract jump slot adjustment logic into a separate function and use it in gen_jumpi and translate_callw. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Diffstat (limited to 'target/xtensa')
-rw-r--r--target/xtensa/translate.c35
1 files changed, 14 insertions, 21 deletions
diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c
index 6e4f0ad..62283cd 100644
--- a/target/xtensa/translate.c
+++ b/target/xtensa/translate.c
@@ -387,13 +387,19 @@ static void gen_jump(DisasContext *dc, TCGv dest)
gen_jump_slot(dc, dest, -1);
}
-static void gen_jumpi(DisasContext *dc, uint32_t dest, int slot)
+static int adjust_jump_slot(DisasContext *dc, uint32_t dest, int slot)
{
- TCGv_i32 tmp = tcg_const_i32(dest);
if (((dc->base.pc_first ^ dest) & TARGET_PAGE_MASK) != 0) {
- slot = -1;
+ return -1;
+ } else {
+ return slot;
}
- gen_jump_slot(dc, tmp, slot);
+}
+
+static void gen_jumpi(DisasContext *dc, uint32_t dest, int slot)
+{
+ TCGv_i32 tmp = tcg_const_i32(dest);
+ gen_jump_slot(dc, tmp, adjust_jump_slot(dc, dest, slot));
tcg_temp_free(tmp);
}
@@ -410,21 +416,6 @@ static void gen_callw_slot(DisasContext *dc, int callinc, TCGv_i32 dest,
gen_jump_slot(dc, dest, slot);
}
-static void gen_callw(DisasContext *dc, int callinc, TCGv_i32 dest)
-{
- gen_callw_slot(dc, callinc, dest, -1);
-}
-
-static void gen_callwi(DisasContext *dc, int callinc, uint32_t dest, int slot)
-{
- TCGv_i32 tmp = tcg_const_i32(dest);
- if (((dc->base.pc_first ^ dest) & TARGET_PAGE_MASK) != 0) {
- slot = -1;
- }
- gen_callw_slot(dc, callinc, tmp, slot);
- tcg_temp_free(tmp);
-}
-
static bool gen_check_loop_end(DisasContext *dc, int slot)
{
if (dc->base.pc_next == dc->lend) {
@@ -1477,7 +1468,9 @@ static void translate_call0(DisasContext *dc, const uint32_t arg[],
static void translate_callw(DisasContext *dc, const uint32_t arg[],
const uint32_t par[])
{
- gen_callwi(dc, par[0], arg[0], 0);
+ TCGv_i32 tmp = tcg_const_i32(arg[0]);
+ gen_callw_slot(dc, par[0], tmp, adjust_jump_slot(dc, arg[0], 0));
+ tcg_temp_free(tmp);
}
static void translate_callx0(DisasContext *dc, const uint32_t arg[],
@@ -1496,7 +1489,7 @@ static void translate_callxw(DisasContext *dc, const uint32_t arg[],
TCGv_i32 tmp = tcg_temp_new_i32();
tcg_gen_mov_i32(tmp, cpu_R[arg[0]]);
- gen_callw(dc, par[0], tmp);
+ gen_callw_slot(dc, par[0], tmp, -1);
tcg_temp_free(tmp);
}