提交 e207582f 编写于 作者: R Richard Henderson

target-i386: Don't clobber s->cc_op in gen_update_cc_op

Use a dirty flag to know whether env->cc_op is up to date,
rather than forcing s->cc_op to DYNAMIC and losing info.
Signed-off-by: NRichard Henderson <rth@twiddle.net>
上级 3ca51d07
...@@ -90,6 +90,7 @@ typedef struct DisasContext { ...@@ -90,6 +90,7 @@ typedef struct DisasContext {
#endif #endif
int ss32; /* 32 bit stack segment */ int ss32; /* 32 bit stack segment */
CCOp cc_op; /* current CC operation */ CCOp cc_op; /* current CC operation */
bool cc_op_dirty;
int addseg; /* non zero if either DS/ES/SS have a non zero base */ int addseg; /* non zero if either DS/ES/SS have a non zero base */
int f_st; /* currently unused */ int f_st; /* currently unused */
int vm86; /* vm86 mode */ int vm86; /* vm86 mode */
...@@ -173,9 +174,27 @@ enum { ...@@ -173,9 +174,27 @@ enum {
OR_A0, /* temporary register used when doing address evaluation */ OR_A0, /* temporary register used when doing address evaluation */
}; };
static inline void set_cc_op(DisasContext *s, CCOp op) static void set_cc_op(DisasContext *s, CCOp op)
{ {
s->cc_op = op; if (s->cc_op != op) {
s->cc_op = op;
/* The DYNAMIC setting is translator only, and should never be
stored. Thus we always consider it clean. */
s->cc_op_dirty = (op != CC_OP_DYNAMIC);
}
}
static inline void gen_op_set_cc_op(int32_t val)
{
tcg_gen_movi_i32(cpu_cc_op, val);
}
static void gen_update_cc_op(DisasContext *s)
{
if (s->cc_op_dirty) {
gen_op_set_cc_op(s->cc_op);
s->cc_op_dirty = false;
}
} }
static inline void gen_op_movl_T0_0(void) static inline void gen_op_movl_T0_0(void)
...@@ -444,11 +463,6 @@ static inline void gen_op_add_reg_T0(int size, int reg) ...@@ -444,11 +463,6 @@ static inline void gen_op_add_reg_T0(int size, int reg)
} }
} }
static inline void gen_op_set_cc_op(int32_t val)
{
tcg_gen_movi_i32(cpu_cc_op, val);
}
static inline void gen_op_addl_A0_reg_sN(int shift, int reg) static inline void gen_op_addl_A0_reg_sN(int shift, int reg)
{ {
tcg_gen_mov_tl(cpu_tmp0, cpu_regs[reg]); tcg_gen_mov_tl(cpu_tmp0, cpu_regs[reg]);
...@@ -800,14 +814,6 @@ static inline void gen_movs(DisasContext *s, int ot) ...@@ -800,14 +814,6 @@ static inline void gen_movs(DisasContext *s, int ot)
gen_op_add_reg_T0(s->aflag, R_EDI); gen_op_add_reg_T0(s->aflag, R_EDI);
} }
static inline void gen_update_cc_op(DisasContext *s)
{
if (s->cc_op != CC_OP_DYNAMIC) {
gen_op_set_cc_op(s->cc_op);
set_cc_op(s, CC_OP_DYNAMIC);
}
}
static void gen_op_update1_cc(void) static void gen_op_update1_cc(void)
{ {
tcg_gen_discard_tl(cpu_cc_src); tcg_gen_discard_tl(cpu_cc_src);
...@@ -7816,6 +7822,7 @@ static inline void gen_intermediate_code_internal(CPUX86State *env, ...@@ -7816,6 +7822,7 @@ static inline void gen_intermediate_code_internal(CPUX86State *env,
dc->tf = (flags >> TF_SHIFT) & 1; dc->tf = (flags >> TF_SHIFT) & 1;
dc->singlestep_enabled = env->singlestep_enabled; dc->singlestep_enabled = env->singlestep_enabled;
dc->cc_op = CC_OP_DYNAMIC; dc->cc_op = CC_OP_DYNAMIC;
dc->cc_op_dirty = false;
dc->cs_base = cs_base; dc->cs_base = cs_base;
dc->tb = tb; dc->tb = tb;
dc->popl_esp_hack = 0; dc->popl_esp_hack = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册