tcg: Remove TCGV_UNUSED* and TCGV_IS_UNUSED*

These are now trivial sets and tests against NULL. Unwrap.

Backports commit f764718d0cb30af9f1f8e1d6a33622cc05ca4155 from qemu
This commit is contained in:
Richard Henderson 2018-03-05 15:51:07 -05:00 committed by Lioncash
parent 640b104ac0
commit 5f074f09ab
No known key found for this signature in database
GPG Key ID: 4E3C3CC1031BA9C7
9 changed files with 47 additions and 65 deletions

View File

@ -422,10 +422,7 @@ static void unallocated_encoding(DisasContext *s)
static void init_tmp_a64_array(DisasContext *s)
{
#ifdef CONFIG_DEBUG_TCG
int i;
for (i = 0; i < ARRAY_SIZE(s->tmp_a64); i++) {
TCGV_UNUSED_I64(s->tmp_a64[i]);
}
memset(s->tmp_a64, 0, sizeof(s->tmp_a64));
#endif
s->tmp_a64_count = 0;
}
@ -6388,7 +6385,7 @@ static void disas_simd_scalar_pairwise(DisasContext *s, uint32_t insn)
return;
}
TCGV_UNUSED_PTR(fpst);
fpst = NULL;
break;
case 0xc: /* FMAXNMP */
case 0xd: /* FADDP */
@ -6483,7 +6480,7 @@ static void disas_simd_scalar_pairwise(DisasContext *s, uint32_t insn)
tcg_temp_free_i32(tcg_ctx, tcg_res);
}
if (!TCGV_IS_UNUSED_PTR(fpst)) {
if (fpst) {
tcg_temp_free_ptr(tcg_ctx, fpst);
}
}
@ -6500,7 +6497,7 @@ static void handle_shri_with_rndacc(DisasContext *s, TCGv_i64 tcg_res, TCGv_i64
{
TCGContext *tcg_ctx = s->uc->tcg_ctx;
bool extended_result = false;
bool round = !TCGV_IS_UNUSED_I64(tcg_rnd);
bool round = tcg_rnd != NULL;
int ext_lshift = 0;
TCGv_i64 tcg_src_hi;
@ -6647,7 +6644,7 @@ static void handle_scalar_simd_shri(DisasContext *s,
uint64_t round_const = 1ULL << (shift - 1);
tcg_round = tcg_const_i64(tcg_ctx, round_const);
} else {
TCGV_UNUSED_I64(tcg_round);
tcg_round = NULL;
}
tcg_rn = read_fp_dreg(s, rn);
@ -6765,7 +6762,7 @@ static void handle_vec_simd_sqshrn(DisasContext *s, bool is_scalar, bool is_q,
uint64_t round_const = 1ULL << (shift - 1);
tcg_round = tcg_const_i64(tcg_ctx, round_const);
} else {
TCGV_UNUSED_I64(tcg_round);
tcg_round = NULL;
}
for (i = 0; i < elements; i++) {
@ -8368,8 +8365,8 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn)
gen_helper_set_rmode(tcg_ctx, tcg_rmode, tcg_rmode, tcg_ctx->cpu_env);
tcg_fpstatus = get_fpstatus_ptr(tcg_ctx);
} else {
TCGV_UNUSED_I32(tcg_rmode);
TCGV_UNUSED_PTR(tcg_fpstatus);
tcg_rmode = NULL;
tcg_fpstatus = NULL;
}
if (size == 3) {
@ -8490,7 +8487,7 @@ static void handle_vec_simd_shri(DisasContext *s, bool is_q, bool is_u,
uint64_t round_const = 1ULL << (shift - 1);
tcg_round = tcg_const_i64(tcg_ctx, round_const);
} else {
TCGV_UNUSED_I64(tcg_round);
tcg_round = NULL;
}
for (i = 0; i < elements; i++) {
@ -8635,7 +8632,7 @@ static void handle_vec_simd_shrn(DisasContext *s, bool is_q,
uint64_t round_const = 1ULL << (shift - 1);
tcg_round = tcg_const_i64(tcg_ctx, round_const);
} else {
TCGV_UNUSED_I64(tcg_round);
tcg_round = NULL;
}
for (i = 0; i < elements; i++) {
@ -9307,7 +9304,7 @@ static void handle_simd_3same_pair(DisasContext *s, int is_q, int u, int opcode,
if (opcode >= 0x58) {
fpst = get_fpstatus_ptr(tcg_ctx);
} else {
TCGV_UNUSED_PTR(fpst);
fpst = NULL;
}
if (!fp_access_check(s)) {
@ -9444,7 +9441,7 @@ static void handle_simd_3same_pair(DisasContext *s, int is_q, int u, int opcode,
}
}
if (!TCGV_IS_UNUSED_PTR(fpst)) {
if (fpst) {
tcg_temp_free_ptr(tcg_ctx, fpst);
}
}
@ -10374,13 +10371,13 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn)
if (need_fpstatus) {
tcg_fpstatus = get_fpstatus_ptr(tcg_ctx);
} else {
TCGV_UNUSED_PTR(tcg_fpstatus);
tcg_fpstatus = NULL;
}
if (need_rmode) {
tcg_rmode = tcg_const_i32(tcg_ctx, arm_rmode_to_sf(rmode));
gen_helper_set_rmode(tcg_ctx, tcg_rmode, tcg_rmode, tcg_ctx->cpu_env);
} else {
TCGV_UNUSED_I32(tcg_rmode);
tcg_rmode = NULL;
}
if (size == 3) {
@ -10742,7 +10739,7 @@ static void disas_simd_indexed(DisasContext *s, uint32_t insn)
if (is_fp) {
fpst = get_fpstatus_ptr(tcg_ctx);
} else {
TCGV_UNUSED_PTR(fpst);
fpst = NULL;
}
if (size == 3) {
@ -11066,7 +11063,7 @@ static void disas_simd_indexed(DisasContext *s, uint32_t insn)
}
}
if (!TCGV_IS_UNUSED_PTR(fpst)) {
if (fpst) {
tcg_temp_free_ptr(tcg_ctx, fpst);
}
}

View File

@ -2255,8 +2255,8 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)
tmp3 = tcg_const_i32(tcg_ctx, (insn & 1) << 5);
break;
default:
TCGV_UNUSED_I32(tmp2);
TCGV_UNUSED_I32(tmp3);
tmp2 = NULL;
tmp3 = NULL;
}
gen_helper_iwmmxt_insr(tcg_ctx, tcg_ctx->cpu_M0, tcg_ctx->cpu_M0, tmp, tmp2, tmp3);
tcg_temp_free_i32(tcg_ctx, tmp3);
@ -5083,7 +5083,7 @@ static int disas_neon_ls_insn(DisasContext *s, uint32_t insn)
}
} else /* size == 0 */ {
if (load) {
TCGV_UNUSED_I32(tmp2);
tmp2 = NULL;
for (n = 0; n < 4; n++) {
tmp = tcg_temp_new_i32(tcg_ctx);
gen_aa32_ld8u(s, tmp, addr, get_mem_index(s));
@ -6802,11 +6802,11 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
tmp = neon_load_reg(tcg_ctx, rn, 1);
neon_store_scratch(tcg_ctx, 2, tmp);
}
TCGV_UNUSED_I32(tmp3);
tmp3 = NULL;
for (pass = 0; pass < 2; pass++) {
if (src1_wide) {
neon_load_reg64(tcg_ctx, tcg_ctx->cpu_V0, rn + pass);
TCGV_UNUSED_I32(tmp);
tmp = NULL;
} else {
if (pass == 1 && rd == rn) {
tmp = neon_load_scratch(tcg_ctx, 2);
@ -6819,7 +6819,7 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
}
if (src2_wide) {
neon_load_reg64(tcg_ctx, tcg_ctx->cpu_V1, rm + pass);
TCGV_UNUSED_I32(tmp2);
tmp2 = NULL;
} else {
if (pass == 1 && rd == rm) {
tmp2 = neon_load_scratch(tcg_ctx, 2);
@ -7237,7 +7237,7 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
if (rm & 1) {
return 1;
}
TCGV_UNUSED_I32(tmp2);
tmp2 = NULL;
for (pass = 0; pass < 2; pass++) {
neon_load_reg64(tcg_ctx, tcg_ctx->cpu_V0, rm + pass);
tmp = tcg_temp_new_i32(tcg_ctx);
@ -7376,7 +7376,7 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
if (neon_2rm_is_float_op(op)) {
tcg_gen_ld_f32(tcg_ctx, tcg_ctx->cpu_F0s, tcg_ctx->cpu_env,
neon_reg_offset(rm, pass));
TCGV_UNUSED_I32(tmp);
tmp = NULL;
} else {
tmp = neon_load_reg(tcg_ctx, rm, pass);
}
@ -8847,7 +8847,7 @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) // qq
rn = (insn >> 16) & 0xf;
tmp = load_reg(s, rn);
} else {
TCGV_UNUSED_I32(tmp);
tmp = NULL;
}
rd = (insn >> 12) & 0xf;
switch(op1) {
@ -9686,7 +9686,7 @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) // qq
/* compute total size */
loaded_base = 0;
TCGV_UNUSED_I32(loaded_var);
loaded_var = NULL;
n = 0;
for(i=0;i<16;i++) {
if (insn & (1 << i))
@ -10257,7 +10257,7 @@ static int disas_thumb2_insn(DisasContext *s, uint32_t insn)
tcg_gen_addi_i32(tcg_ctx, addr, addr, 0-offset);
}
TCGV_UNUSED_I32(loaded_var);
loaded_var = NULL;
for (i = 0; i < 16; i++) {
if ((insn & (1 << i)) == 0)
continue;
@ -11566,7 +11566,7 @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn)
} else if (op != 0xf) { /* mvn doesn't read its first operand */
tmp = load_reg(s, rd);
} else {
TCGV_UNUSED_I32(tmp);
tmp = NULL;
}
tmp2 = load_reg(s, rm);
@ -11897,7 +11897,7 @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn)
tcg_gen_addi_i32(tcg_ctx, addr, addr, 4);
}
}
TCGV_UNUSED_I32(tmp);
tmp = NULL;
if (insn & (1 << 8)) {
if (insn & (1 << 11)) {
/* pop pc */
@ -12042,8 +12042,7 @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn)
case 12:
{
/* load/store multiple */
TCGv_i32 loaded_var;
TCGV_UNUSED_I32(loaded_var);
TCGv_i32 loaded_var = NULL;
rn = (insn >> 8) & 0x7;
addr = load_reg(s, rn);
for (i = 0; i < 8; i++) {

View File

@ -835,7 +835,7 @@ static void gen_compute_eflags(DisasContext *s)
return;
}
TCGV_UNUSED(zero);
zero = NULL;
dst = cpu_cc_dst;
src1 = cpu_cc_src;
src2 = cpu_cc_src2;
@ -2316,8 +2316,7 @@ static TCGv gen_lea_modrm_1(DisasContext *s, AddressParts a)
TCGContext *tcg_ctx = s->uc->tcg_ctx;
TCGv cpu_A0 = tcg_ctx->cpu_A0;
TCGv *cpu_regs = tcg_ctx->cpu_regs;
TCGv ea;
TCGV_UNUSED(ea);
TCGv ea = NULL;
if (a.index >= 0) {
if (a.scale == 0) {
@ -2333,7 +2332,7 @@ static TCGv gen_lea_modrm_1(DisasContext *s, AddressParts a)
} else if (a.base >= 0) {
ea = cpu_regs[a.base];
}
if (TCGV_IS_UNUSED(ea)) {
if (!ea) {
tcg_gen_movi_tl(tcg_ctx, cpu_A0, a.disp);
ea = cpu_A0;
} else if (a.disp != 0) {
@ -4520,7 +4519,7 @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b,
gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0);
/* Re-use the carry-out from a previous round. */
TCGV_UNUSED(carry_in);
carry_in = NULL;
carry_out = (b == 0x1f6 ? cpu_cc_dst : cpu_cc_src2);
switch (s->cc_op) {
case CC_OP_ADCX:
@ -4548,7 +4547,7 @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b,
break;
}
/* If we can't reuse carry-out, get it out of EFLAGS. */
if (TCGV_IS_UNUSED(carry_in)) {
if (!carry_in) {
if (s->cc_op != CC_OP_ADCX && s->cc_op != CC_OP_ADOX) {
gen_compute_eflags(s);
}
@ -8361,7 +8360,7 @@ case 0x101:
tcg_gen_mov_tl(tcg_ctx, a0, cpu_A0);
} else {
gen_op_mov_v_reg(tcg_ctx, ot, t0, rm);
TCGV_UNUSED(a0);
a0 = NULL;
}
gen_op_mov_v_reg(tcg_ctx, ot, t1, reg);
tcg_gen_andi_tl(tcg_ctx, cpu_tmp0, t0, 3);

View File

@ -4110,8 +4110,8 @@ DISAS_INSN(bfop_reg)
int ofs = extract32(ext, 6, 5); /* big bit-endian */
TCGv mask, tofs, tlen;
TCGV_UNUSED(tofs);
TCGV_UNUSED(tlen);
tofs = NULL;
tlen = NULL;
if ((insn & 0x0f00) == 0x0d00) { /* bfffo */
tofs = tcg_temp_new(tcg_ctx);
tlen = tcg_temp_new(tcg_ctx);
@ -4127,7 +4127,7 @@ DISAS_INSN(bfop_reg)
}
tcg_gen_andi_i32(tcg_ctx, tcg_ctx->QREG_CC_N, tcg_ctx->QREG_CC_N, ~maski);
mask = tcg_const_i32(tcg_ctx, ror32(maski, ofs));
if (!TCGV_IS_UNUSED(tofs)) {
if (tofs) {
tcg_gen_movi_i32(tcg_ctx, tofs, ofs);
tcg_gen_movi_i32(tcg_ctx, tlen, len);
}
@ -4139,13 +4139,13 @@ DISAS_INSN(bfop_reg)
tcg_gen_andi_i32(tcg_ctx, tmp, tmp, 31);
mask = tcg_const_i32(tcg_ctx, 0x7fffffffu);
tcg_gen_shr_i32(tcg_ctx, mask, mask, tmp);
if (!TCGV_IS_UNUSED(tlen)) {
if (tlen) {
tcg_gen_addi_i32(tcg_ctx, tlen, tmp, 1);
}
} else {
/* Immediate width */
mask = tcg_const_i32(tcg_ctx, 0x7fffffffu >> (len - 1));
if (!TCGV_IS_UNUSED(tlen)) {
if (tlen) {
tcg_gen_movi_i32(tcg_ctx, tlen, len);
}
}
@ -4155,7 +4155,7 @@ DISAS_INSN(bfop_reg)
tcg_gen_rotl_i32(tcg_ctx, tcg_ctx->QREG_CC_N, src, tmp);
tcg_gen_andc_i32(tcg_ctx, tcg_ctx->QREG_CC_N, tcg_ctx->QREG_CC_N, mask);
tcg_gen_rotr_i32(tcg_ctx, mask, mask, tmp);
if (!TCGV_IS_UNUSED(tofs)) {
if (tofs) {
tcg_gen_mov_i32(tcg_ctx, tofs, tmp);
}
} else {
@ -4163,7 +4163,7 @@ DISAS_INSN(bfop_reg)
tcg_gen_rotli_i32(tcg_ctx, tcg_ctx->QREG_CC_N, src, ofs);
tcg_gen_andc_i32(tcg_ctx, tcg_ctx->QREG_CC_N, tcg_ctx->QREG_CC_N, mask);
tcg_gen_rotri_i32(tcg_ctx, mask, mask, ofs);
if (!TCGV_IS_UNUSED(tofs)) {
if (tofs) {
tcg_gen_movi_i32(tcg_ctx, tofs, ofs);
}
}

View File

@ -20667,7 +20667,7 @@ void mips_tcg_init(struct uc_struct *uc)
regnames[i]);
}
TCGV_UNUSED(cpu_gpr[0]);
cpu_gpr[0] = NULL;
for (i = 0; i < 32; i++) {
int off = offsetof(CPUMIPSState, active_fpu.fpr[i].wr.d[0]);

View File

@ -6175,7 +6175,7 @@ void sparc_tcg_init(struct uc_struct *uc)
"tbr");
#endif
TCGV_UNUSED(tcg_ctx->cpu_regs[0]);
tcg_ctx->cpu_regs[0] = NULL;
for (i = 1; i < 8; ++i) {
tcg_ctx->cpu_regs_sparc[i] = tcg_global_mem_new(tcg_ctx, tcg_ctx->cpu_env,
offsetof(CPUSPARCState, gregs[i]),

View File

@ -813,8 +813,6 @@ void tcg_gen_lookup_and_goto_ptr(TCGContext *s);
#define tcg_global_mem_new tcg_global_mem_new_i32
#define tcg_temp_local_new(s) tcg_temp_local_new_i32(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 tcg_gen_qemu_ld_tl tcg_gen_qemu_ld_i32
#define tcg_gen_qemu_st_tl tcg_gen_qemu_st_i32
#else
@ -823,8 +821,6 @@ void tcg_gen_lookup_and_goto_ptr(TCGContext *s);
#define tcg_global_mem_new tcg_global_mem_new_i64
#define tcg_temp_local_new(s) tcg_temp_local_new_i64(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 tcg_gen_qemu_ld_tl tcg_gen_qemu_ld_i64
#define tcg_gen_qemu_st_tl tcg_gen_qemu_st_i64
#endif

View File

@ -1013,8 +1013,8 @@ void tcg_gen_callN(TCGContext *s, void *func, TCGTemp *ret, int nargs, TCGTemp *
TCGv_i64 retl, reth;
TCGTemp *split_args[MAX_OPC_PARAM];
TCGV_UNUSED_I64(retl);
TCGV_UNUSED_I64(reth);
retl = NULL;
reth = NULL;
if (sizemask != 0) {
for (i = real_args = 0; i < nargs; ++i) {
int is_64bit = sizemask & (1 << (i+1)*2);

View File

@ -431,15 +431,6 @@ typedef TCGv_ptr TCGv_env;
#error Unhandled TARGET_LONG_BITS value
#endif
/* See the comment before tcgv_i32_temp. */
#define TCGV_UNUSED_I32(x) (x = (TCGv_i32)NULL)
#define TCGV_UNUSED_I64(x) (x = (TCGv_i64)NULL)
#define TCGV_UNUSED_PTR(x) (x = (TCGv_ptr)NULL)
#define TCGV_IS_UNUSED_I32(x) ((x) == (TCGv_i32)NULL)
#define TCGV_IS_UNUSED_I64(x) ((x) == (TCGv_i64)NULL)
#define TCGV_IS_UNUSED_PTR(x) ((x) == (TCGv_ptr)NULL)
/* call flags */
/* Helper does not read globals (either directly or through an exception). It
implies TCG_CALL_NO_WRITE_GLOBALS. */