From 4d9c8583faa2c0c390dd04f9e1a41927427031b5 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Mon, 5 Mar 2018 09:15:59 -0500 Subject: [PATCH] tcg: Remove TCGV_EQUAL* When we used structures for TCGv_*, we needed a macro in order to perform a comparison. Now that we use pointers, this is just clutter Backports commit 11f4e8f8bfaa2caaab24bef6bbbb8a0205015119 from qemu --- qemu/target/i386/translate.c | 6 +++--- qemu/target/m68k/translate.c | 2 +- qemu/tcg/tcg-op.h | 6 ++---- qemu/tcg/tcg.h | 4 ---- 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/qemu/target/i386/translate.c b/qemu/target/i386/translate.c index 0b771c58..a143b46b 100644 --- a/qemu/target/i386/translate.c +++ b/qemu/target/i386/translate.c @@ -903,7 +903,7 @@ static CCPrepare gen_prepare_eflags_c(DisasContext *s, TCGv reg) size = s->cc_op - CC_OP_SUBB; t1 = gen_ext_tl(tcg_ctx, cpu_tmp0, cpu_cc_src, size, false); /* If no temporary was used, be careful not to alias t1 and t0. */ - t0 = TCGV_EQUAL(t1, cpu_cc_src) ? cpu_tmp0 : reg; + t0 = t1 == cpu_cc_src ? cpu_tmp0 : reg; tcg_gen_mov_tl(tcg_ctx, t0, cpu_cc_srcT); gen_extu(tcg_ctx, size, t0); goto add_sub; @@ -1115,7 +1115,7 @@ static CCPrepare gen_prepare_cc(DisasContext *s, int b, TCGv reg) break; case JCC_L: gen_compute_eflags(s); - if (TCGV_EQUAL(reg, cpu_cc_src)) { + if (reg == cpu_cc_src) { reg = cpu_tmp0; } tcg_gen_shri_tl(tcg_ctx, reg, cpu_cc_src, 4); /* CC_O -> CC_S */ @@ -1125,7 +1125,7 @@ static CCPrepare gen_prepare_cc(DisasContext *s, int b, TCGv reg) default: case JCC_LE: gen_compute_eflags(s); - if (TCGV_EQUAL(reg, cpu_cc_src)) { + if (reg == cpu_cc_src) { reg = cpu_tmp0; } tcg_gen_shri_tl(tcg_ctx, reg, cpu_cc_src, 4); /* CC_O -> CC_S */ diff --git a/qemu/target/m68k/translate.c b/qemu/target/m68k/translate.c index 78ee71a9..889288db 100644 --- a/qemu/target/m68k/translate.c +++ b/qemu/target/m68k/translate.c @@ -39,7 +39,7 @@ #define MACREG(acc) tcg_ctx->cpu_macc[acc] #define QREG_SP tcg_ctx->cpu_aregs[7] -#define IS_NULL_QREG(t) (TCGV_EQUAL(t, tcg_ctx->NULL_QREG)) +#define IS_NULL_QREG(t) (t == tcg_ctx->NULL_QREG) void m68k_tcg_init(struct uc_struct *uc) { diff --git a/qemu/tcg/tcg-op.h b/qemu/tcg/tcg-op.h index c3823fc1..9d4afeb8 100644 --- a/qemu/tcg/tcg-op.h +++ b/qemu/tcg/tcg-op.h @@ -341,7 +341,7 @@ static inline void tcg_gen_discard_i32(TCGContext *s, TCGv_i32 arg) static inline void tcg_gen_mov_i32(TCGContext *s, TCGv_i32 ret, TCGv_i32 arg) { - if (!TCGV_EQUAL_I32(ret, arg)) { + if (ret != arg) { tcg_gen_op2_i32(s, INDEX_op_mov_i32, ret, arg); } } @@ -527,7 +527,7 @@ static inline void tcg_gen_discard_i64(TCGContext *s, TCGv_i64 arg) static inline void tcg_gen_mov_i64(TCGContext *s, TCGv_i64 ret, TCGv_i64 arg) { - if (!TCGV_EQUAL_I64(ret, arg)) { + if (ret != arg) { tcg_gen_op2_i64(s, INDEX_op_mov_i64, ret, arg); } } @@ -815,7 +815,6 @@ void tcg_gen_lookup_and_goto_ptr(TCGContext *s); #define tcg_temp_free tcg_temp_free_i32 #define TCGV_UNUSED(x) TCGV_UNUSED_I32(x) #define TCGV_IS_UNUSED(x) TCGV_IS_UNUSED_I32(x) -#define TCGV_EQUAL(a, b) TCGV_EQUAL_I32(a, b) #define tcg_gen_qemu_ld_tl tcg_gen_qemu_ld_i32 #define tcg_gen_qemu_st_tl tcg_gen_qemu_st_i32 #else @@ -826,7 +825,6 @@ void tcg_gen_lookup_and_goto_ptr(TCGContext *s); #define tcg_temp_free tcg_temp_free_i64 #define TCGV_UNUSED(x) TCGV_UNUSED_I64(x) #define TCGV_IS_UNUSED(x) TCGV_IS_UNUSED_I64(x) -#define TCGV_EQUAL(a, b) TCGV_EQUAL_I64(a, b) #define tcg_gen_qemu_ld_tl tcg_gen_qemu_ld_i64 #define tcg_gen_qemu_st_tl tcg_gen_qemu_st_i64 #endif diff --git a/qemu/tcg/tcg.h b/qemu/tcg/tcg.h index 1d690437..6d257ccc 100644 --- a/qemu/tcg/tcg.h +++ b/qemu/tcg/tcg.h @@ -431,10 +431,6 @@ typedef TCGv_ptr TCGv_env; #error Unhandled TARGET_LONG_BITS value #endif -#define TCGV_EQUAL_I32(a, b) ((a) == (b)) -#define TCGV_EQUAL_I64(a, b) ((a) == (b)) -#define TCGV_EQUAL_PTR(a, b) ((a) == (b)) - /* Dummy definition to avoid compiler warnings. */ #define TCGV_UNUSED_I32(x) (x = (TCGv_i32)-1) #define TCGV_UNUSED_I64(x) (x = (TCGv_i64)-1)