target-s390: Optmize emitting discards

While they aren't expensive, they aren't free to process.  When we
know that the three cc helper variables are dead, don't kill them.

Signed-off-by: Richard Henderson <rth@twiddle.net>
This commit is contained in:
Richard Henderson 2012-09-19 13:50:07 -07:00
parent d074ac6d26
commit f24c49c24a

View File

@ -367,25 +367,41 @@ static TCGv_i64 get_address(DisasContext *s, int x2, int b2, int d2)
return tmp;
}
static inline bool live_cc_data(DisasContext *s)
{
return (s->cc_op != CC_OP_DYNAMIC
&& s->cc_op != CC_OP_STATIC
&& s->cc_op > 3);
}
static inline void gen_op_movi_cc(DisasContext *s, uint32_t val)
{
if (live_cc_data(s)) {
tcg_gen_discard_i64(cc_src);
tcg_gen_discard_i64(cc_dst);
tcg_gen_discard_i64(cc_vr);
}
s->cc_op = CC_OP_CONST0 + val;
}
static void gen_op_update1_cc_i64(DisasContext *s, enum cc_op op, TCGv_i64 dst)
{
if (live_cc_data(s)) {
tcg_gen_discard_i64(cc_src);
tcg_gen_mov_i64(cc_dst, dst);
tcg_gen_discard_i64(cc_vr);
}
tcg_gen_mov_i64(cc_dst, dst);
s->cc_op = op;
}
static void gen_op_update2_cc_i64(DisasContext *s, enum cc_op op, TCGv_i64 src,
TCGv_i64 dst)
{
if (live_cc_data(s)) {
tcg_gen_discard_i64(cc_vr);
}
tcg_gen_mov_i64(cc_src, src);
tcg_gen_mov_i64(cc_dst, dst);
tcg_gen_discard_i64(cc_vr);
s->cc_op = op;
}
@ -421,9 +437,11 @@ static void gen_set_cc_nz_f128(DisasContext *s, TCGv_i64 vh, TCGv_i64 vl)
/* CC value is in env->cc_op */
static void set_cc_static(DisasContext *s)
{
if (live_cc_data(s)) {
tcg_gen_discard_i64(cc_src);
tcg_gen_discard_i64(cc_dst);
tcg_gen_discard_i64(cc_vr);
}
s->cc_op = CC_OP_STATIC;
}