aboutsummaryrefslogtreecommitdiff
path: root/target-sparc
diff options
context:
space:
mode:
authorBlue Swirl <blauwirbel@gmail.com>2011-07-03 16:01:57 +0000
committerBlue Swirl <blauwirbel@gmail.com>2011-10-23 15:09:37 +0000
commit2ffd9176b10caefab5f2bade13b1b54154266b35 (patch)
treecb0c460c8e9bdaf2210d9ed5acc0287e7abc9205 /target-sparc
parentcffc581873fdb482644acfc4f61d294ad4e81cf0 (diff)
Sparc: avoid AREG0 for lazy condition code helpers
Make lazy condition code helpers take a parameter for CPUState instead of relying on global env. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'target-sparc')
-rw-r--r--target-sparc/cc_helper.c73
-rw-r--r--target-sparc/helper.h4
-rw-r--r--target-sparc/op_helper.c2
-rw-r--r--target-sparc/translate.c18
4 files changed, 48 insertions, 49 deletions
diff --git a/target-sparc/cc_helper.c b/target-sparc/cc_helper.c
index a067397cc8..04bd2cf9c7 100644
--- a/target-sparc/cc_helper.c
+++ b/target-sparc/cc_helper.c
@@ -18,15 +18,14 @@
*/
#include "cpu.h"
-#include "dyngen-exec.h"
#include "helper.h"
-static uint32_t compute_all_flags(void)
+static uint32_t compute_all_flags(CPUState *env)
{
return env->psr & PSR_ICC;
}
-static uint32_t compute_C_flags(void)
+static uint32_t compute_C_flags(CPUState *env)
{
return env->psr & PSR_CARRY;
}
@@ -44,12 +43,12 @@ static inline uint32_t get_NZ_icc(int32_t dst)
}
#ifdef TARGET_SPARC64
-static uint32_t compute_all_flags_xcc(void)
+static uint32_t compute_all_flags_xcc(CPUState *env)
{
return env->xcc & PSR_ICC;
}
-static uint32_t compute_C_flags_xcc(void)
+static uint32_t compute_C_flags_xcc(CPUState *env)
{
return env->xcc & PSR_CARRY;
}
@@ -77,7 +76,7 @@ static inline uint32_t get_V_div_icc(target_ulong src2)
return ret;
}
-static uint32_t compute_all_div(void)
+static uint32_t compute_all_div(CPUState *env)
{
uint32_t ret;
@@ -86,7 +85,7 @@ static uint32_t compute_all_div(void)
return ret;
}
-static uint32_t compute_C_div(void)
+static uint32_t compute_C_div(CPUState *env)
{
return 0;
}
@@ -156,7 +155,7 @@ static inline uint32_t get_V_add_xcc(target_ulong dst, target_ulong src1,
return ret;
}
-static uint32_t compute_all_add_xcc(void)
+static uint32_t compute_all_add_xcc(CPUState *env)
{
uint32_t ret;
@@ -166,13 +165,13 @@ static uint32_t compute_all_add_xcc(void)
return ret;
}
-static uint32_t compute_C_add_xcc(void)
+static uint32_t compute_C_add_xcc(CPUState *env)
{
return get_C_add_xcc(CC_DST, CC_SRC);
}
#endif
-static uint32_t compute_all_add(void)
+static uint32_t compute_all_add(CPUState *env)
{
uint32_t ret;
@@ -182,13 +181,13 @@ static uint32_t compute_all_add(void)
return ret;
}
-static uint32_t compute_C_add(void)
+static uint32_t compute_C_add(CPUState *env)
{
return get_C_add_icc(CC_DST, CC_SRC);
}
#ifdef TARGET_SPARC64
-static uint32_t compute_all_addx_xcc(void)
+static uint32_t compute_all_addx_xcc(CPUState *env)
{
uint32_t ret;
@@ -198,7 +197,7 @@ static uint32_t compute_all_addx_xcc(void)
return ret;
}
-static uint32_t compute_C_addx_xcc(void)
+static uint32_t compute_C_addx_xcc(CPUState *env)
{
uint32_t ret;
@@ -207,7 +206,7 @@ static uint32_t compute_C_addx_xcc(void)
}
#endif
-static uint32_t compute_all_addx(void)
+static uint32_t compute_all_addx(CPUState *env)
{
uint32_t ret;
@@ -217,7 +216,7 @@ static uint32_t compute_all_addx(void)
return ret;
}
-static uint32_t compute_C_addx(void)
+static uint32_t compute_C_addx(CPUState *env)
{
uint32_t ret;
@@ -235,7 +234,7 @@ static inline uint32_t get_V_tag_icc(target_ulong src1, target_ulong src2)
return ret;
}
-static uint32_t compute_all_tadd(void)
+static uint32_t compute_all_tadd(CPUState *env)
{
uint32_t ret;
@@ -246,7 +245,7 @@ static uint32_t compute_all_tadd(void)
return ret;
}
-static uint32_t compute_all_taddtv(void)
+static uint32_t compute_all_taddtv(CPUState *env)
{
uint32_t ret;
@@ -321,7 +320,7 @@ static inline uint32_t get_V_sub_xcc(target_ulong dst, target_ulong src1,
return ret;
}
-static uint32_t compute_all_sub_xcc(void)
+static uint32_t compute_all_sub_xcc(CPUState *env)
{
uint32_t ret;
@@ -331,13 +330,13 @@ static uint32_t compute_all_sub_xcc(void)
return ret;
}
-static uint32_t compute_C_sub_xcc(void)
+static uint32_t compute_C_sub_xcc(CPUState *env)
{
return get_C_sub_xcc(CC_SRC, CC_SRC2);
}
#endif
-static uint32_t compute_all_sub(void)
+static uint32_t compute_all_sub(CPUState *env)
{
uint32_t ret;
@@ -347,13 +346,13 @@ static uint32_t compute_all_sub(void)
return ret;
}
-static uint32_t compute_C_sub(void)
+static uint32_t compute_C_sub(CPUState *env)
{
return get_C_sub_icc(CC_SRC, CC_SRC2);
}
#ifdef TARGET_SPARC64
-static uint32_t compute_all_subx_xcc(void)
+static uint32_t compute_all_subx_xcc(CPUState *env)
{
uint32_t ret;
@@ -363,7 +362,7 @@ static uint32_t compute_all_subx_xcc(void)
return ret;
}
-static uint32_t compute_C_subx_xcc(void)
+static uint32_t compute_C_subx_xcc(CPUState *env)
{
uint32_t ret;
@@ -372,7 +371,7 @@ static uint32_t compute_C_subx_xcc(void)
}
#endif
-static uint32_t compute_all_subx(void)
+static uint32_t compute_all_subx(CPUState *env)
{
uint32_t ret;
@@ -382,7 +381,7 @@ static uint32_t compute_all_subx(void)
return ret;
}
-static uint32_t compute_C_subx(void)
+static uint32_t compute_C_subx(CPUState *env)
{
uint32_t ret;
@@ -390,7 +389,7 @@ static uint32_t compute_C_subx(void)
return ret;
}
-static uint32_t compute_all_tsub(void)
+static uint32_t compute_all_tsub(CPUState *env)
{
uint32_t ret;
@@ -401,7 +400,7 @@ static uint32_t compute_all_tsub(void)
return ret;
}
-static uint32_t compute_all_tsubtv(void)
+static uint32_t compute_all_tsubtv(CPUState *env)
{
uint32_t ret;
@@ -410,26 +409,26 @@ static uint32_t compute_all_tsubtv(void)
return ret;
}
-static uint32_t compute_all_logic(void)
+static uint32_t compute_all_logic(CPUState *env)
{
return get_NZ_icc(CC_DST);
}
-static uint32_t compute_C_logic(void)
+static uint32_t compute_C_logic(CPUState *env)
{
return 0;
}
#ifdef TARGET_SPARC64
-static uint32_t compute_all_logic_xcc(void)
+static uint32_t compute_all_logic_xcc(CPUState *env)
{
return get_NZ_xcc(CC_DST);
}
#endif
typedef struct CCTable {
- uint32_t (*compute_all)(void); /* return all the flags */
- uint32_t (*compute_c)(void); /* return the C flag */
+ uint32_t (*compute_all)(CPUState *env); /* return all the flags */
+ uint32_t (*compute_c)(CPUState *env); /* return the C flag */
} CCTable;
static const CCTable icc_table[CC_OP_NB] = {
@@ -464,23 +463,23 @@ static const CCTable xcc_table[CC_OP_NB] = {
};
#endif
-void helper_compute_psr(void)
+void helper_compute_psr(CPUState *env)
{
uint32_t new_psr;
- new_psr = icc_table[CC_OP].compute_all();
+ new_psr = icc_table[CC_OP].compute_all(env);
env->psr = new_psr;
#ifdef TARGET_SPARC64
- new_psr = xcc_table[CC_OP].compute_all();
+ new_psr = xcc_table[CC_OP].compute_all(env);
env->xcc = new_psr;
#endif
CC_OP = CC_OP_FLAGS;
}
-uint32_t helper_compute_C_icc(void)
+uint32_t helper_compute_C_icc(CPUState *env)
{
uint32_t ret;
- ret = icc_table[CC_OP].compute_c() >> PSR_CARRY_SHIFT;
+ ret = icc_table[CC_OP].compute_c(env) >> PSR_CARRY_SHIFT;
return ret;
}
diff --git a/target-sparc/helper.h b/target-sparc/helper.h
index fe63846434..57d0073f2b 100644
--- a/target-sparc/helper.h
+++ b/target-sparc/helper.h
@@ -159,7 +159,7 @@ VIS_CMPHELPER(cmpne);
#undef F_HELPER_DQ_0_1
#undef VIS_HELPER
#undef VIS_CMPHELPER
-DEF_HELPER_0(compute_psr, void);
-DEF_HELPER_0(compute_C_icc, i32);
+DEF_HELPER_1(compute_psr, void, env);
+DEF_HELPER_1(compute_C_icc, i32, env);
#include "def-helper.h"
diff --git a/target-sparc/op_helper.c b/target-sparc/op_helper.c
index 33d46a4c04..18a00d4cea 100644
--- a/target-sparc/op_helper.c
+++ b/target-sparc/op_helper.c
@@ -372,7 +372,7 @@ void cpu_set_cwp(CPUState *env1, int new_cwp)
static target_ulong get_psr(void)
{
- helper_compute_psr();
+ helper_compute_psr(env);
#if !defined (TARGET_SPARC64)
return env->version | (env->psr & PSR_ICC) |
diff --git a/target-sparc/translate.c b/target-sparc/translate.c
index 8c05c44a80..214252aeb4 100644
--- a/target-sparc/translate.c
+++ b/target-sparc/translate.c
@@ -428,7 +428,7 @@ static void gen_op_addx_int(DisasContext *dc, TCGv dst, TCGv src1,
default:
/* We need external help to produce the carry. */
carry_32 = tcg_temp_new_i32();
- gen_helper_compute_C_icc(carry_32);
+ gen_helper_compute_C_icc(carry_32, cpu_env);
break;
}
@@ -567,7 +567,7 @@ static void gen_op_subx_int(DisasContext *dc, TCGv dst, TCGv src1,
default:
/* We need external help to produce the carry. */
carry_32 = tcg_temp_new_i32();
- gen_helper_compute_C_icc(carry_32);
+ gen_helper_compute_C_icc(carry_32, cpu_env);
break;
}
@@ -1091,7 +1091,7 @@ static inline void save_state(DisasContext *dc, TCGv cond)
/* flush pending conditional evaluations before exposing cpu state */
if (dc->cc_op != CC_OP_FLAGS) {
dc->cc_op = CC_OP_FLAGS;
- gen_helper_compute_psr();
+ gen_helper_compute_psr(cpu_env);
}
save_npc(dc, cond);
}
@@ -1133,7 +1133,7 @@ static inline void gen_cond(TCGv r_dst, unsigned int cc, unsigned int cond,
case CC_OP_FLAGS:
break;
default:
- gen_helper_compute_psr();
+ gen_helper_compute_psr(cpu_env);
dc->cc_op = CC_OP_FLAGS;
break;
}
@@ -2106,7 +2106,7 @@ static void disas_sparc_insn(DisasContext * dc)
break;
#ifdef TARGET_SPARC64
case 0x2: /* V9 rdccr */
- gen_helper_compute_psr();
+ gen_helper_compute_psr(cpu_env);
gen_helper_rdccr(cpu_dst);
gen_movl_TN_reg(rd, cpu_dst);
break;
@@ -2182,7 +2182,7 @@ static void disas_sparc_insn(DisasContext * dc)
#ifndef TARGET_SPARC64
if (!supervisor(dc))
goto priv_insn;
- gen_helper_compute_psr();
+ gen_helper_compute_psr(cpu_env);
dc->cc_op = CC_OP_FLAGS;
gen_helper_rdpsr(cpu_dst);
#else
@@ -3321,7 +3321,7 @@ static void disas_sparc_insn(DisasContext * dc)
dc->cc_op = CC_OP_TSUBTV;
break;
case 0x24: /* mulscc */
- gen_helper_compute_psr();
+ gen_helper_compute_psr(cpu_env);
gen_op_mulscc(cpu_dst, cpu_src1, cpu_src2);
gen_movl_TN_reg(rd, cpu_dst);
tcg_gen_movi_i32(cpu_cc_op, CC_OP_ADD);
@@ -4417,7 +4417,7 @@ static void disas_sparc_insn(DisasContext * dc)
cpu state */
if (dc->cc_op != CC_OP_FLAGS) {
dc->cc_op = CC_OP_FLAGS;
- gen_helper_compute_psr();
+ gen_helper_compute_psr(cpu_env);
}
cpu_src1 = get_src1(insn, cpu_src1);
if (xop == 0x3c || xop == 0x3e) { // V9 casa/casxa
@@ -5269,6 +5269,6 @@ void restore_state_to_opc(CPUState *env, TranslationBlock *tb, int pc_pos)
/* flush pending conditional evaluations before exposing cpu state */
if (CC_OP != CC_OP_FLAGS) {
- helper_compute_psr();
+ helper_compute_psr(env);
}
}