tcg/optimize: Use tcg_constant_internal with constant folding

Backport 8fe35e0444be88de4e3ab80a2a0e210a1f6d663d
This commit is contained in:
Richard Henderson 2021-03-04 11:32:24 -05:00 committed by Lioncash
parent 0038cda620
commit 541ef541ae
2 changed files with 116 additions and 114 deletions

View file

@ -987,7 +987,7 @@ typedef uint64_t FullLoadHelper(CPUArchState *env, target_ulong addr,
static inline uint64_t __attribute__((always_inline))
load_helper(CPUArchState *env, target_ulong addr, TCGMemOpIdx oi,
uintptr_t retaddr, MemOp op, bool code_read, FullLoadHelper *full_load)
uintptr_t retaddr, MemOp op, bool code_read, bool is_softmmu_access, FullLoadHelper *full_load)
{
uintptr_t mmu_idx = get_mmuidx(oi);
uintptr_t index = tlb_index(env, mmu_idx, addr);
@ -1012,7 +1012,17 @@ load_helper(CPUArchState *env, target_ulong addr, TCGMemOpIdx oi,
// memory might be still unmapped while reading or fetching
if (mr == NULL) {
handled = false;
if (is_softmmu_access) {
error_code = UC_ERR_FETCH_UNMAPPED;
HOOK_FOREACH(uc, hook, UC_HOOK_MEM_FETCH_UNMAPPED) {
if (!HOOK_BOUND_CHECK(hook, addr)) {
continue;
}
if ((handled = ((uc_cb_eventmem_t)hook->callback)(uc, UC_MEM_FETCH_UNMAPPED, addr, size, 0, hook->user_data))) {
break;
}
}
} else {
error_code = UC_ERR_READ_UNMAPPED;
HOOK_FOREACH(uc, hook, UC_HOOK_MEM_READ_UNMAPPED) {
if (!HOOK_BOUND_CHECK(hook, addr)) {
@ -1022,6 +1032,7 @@ load_helper(CPUArchState *env, target_ulong addr, TCGMemOpIdx oi,
break;
}
}
}
if (handled) {
env->invalid_error = UC_ERR_OK;
@ -1036,6 +1047,7 @@ load_helper(CPUArchState *env, target_ulong addr, TCGMemOpIdx oi,
}
// Unicorn: callback on fetch from NX
if (is_softmmu_access) {
if (mr != NULL && !(mr->perms & UC_PROT_EXEC)) {
handled = false;
HOOK_FOREACH(uc, hook, UC_HOOK_MEM_FETCH_PROT) {
@ -1057,6 +1069,7 @@ load_helper(CPUArchState *env, target_ulong addr, TCGMemOpIdx oi,
return 0;
}
}
}
// Unicorn: callback on memory read
// NOTE: this happens before the actual read, so we cannot tell
@ -1223,7 +1236,7 @@ finished:
static uint64_t full_ldub_mmu(CPUArchState *env, target_ulong addr,
TCGMemOpIdx oi, uintptr_t retaddr)
{
return load_helper(env, addr, oi, retaddr, MO_UB, false,
return load_helper(env, addr, oi, retaddr, MO_UB, false, false,
full_ldub_mmu);
}
@ -1236,7 +1249,7 @@ tcg_target_ulong helper_ret_ldub_mmu(CPUArchState *env, target_ulong addr,
static uint64_t full_le_lduw_mmu(CPUArchState *env, target_ulong addr,
TCGMemOpIdx oi, uintptr_t retaddr)
{
return load_helper(env, addr, oi, retaddr, MO_LEUW, false,
return load_helper(env, addr, oi, retaddr, MO_LEUW, false, false,
full_le_lduw_mmu);
}
@ -1249,7 +1262,7 @@ tcg_target_ulong helper_le_lduw_mmu(CPUArchState *env, target_ulong addr,
static uint64_t full_be_lduw_mmu(CPUArchState *env, target_ulong addr,
TCGMemOpIdx oi, uintptr_t retaddr)
{
return load_helper(env, addr, oi, retaddr, MO_BEUW, false,
return load_helper(env, addr, oi, retaddr, MO_BEUW, false, false,
full_be_lduw_mmu);
}
@ -1262,7 +1275,7 @@ tcg_target_ulong helper_be_lduw_mmu(CPUArchState *env, target_ulong addr,
static uint64_t full_le_ldul_mmu(CPUArchState *env, target_ulong addr,
TCGMemOpIdx oi, uintptr_t retaddr)
{
return load_helper(env, addr, oi, retaddr, MO_LEUL, false,
return load_helper(env, addr, oi, retaddr, MO_LEUL, false, false,
full_le_ldul_mmu);
}
@ -1275,7 +1288,7 @@ tcg_target_ulong helper_le_ldul_mmu(CPUArchState *env, target_ulong addr,
static uint64_t full_be_ldul_mmu(CPUArchState *env, target_ulong addr,
TCGMemOpIdx oi, uintptr_t retaddr)
{
return load_helper(env, addr, oi, retaddr, MO_BEUL, false,
return load_helper(env, addr, oi, retaddr, MO_BEUL, false, false,
full_be_ldul_mmu);
}
@ -1288,14 +1301,14 @@ tcg_target_ulong helper_be_ldul_mmu(CPUArchState *env, target_ulong addr,
uint64_t helper_le_ldq_mmu(CPUArchState *env, target_ulong addr,
TCGMemOpIdx oi, uintptr_t retaddr)
{
return load_helper(env, addr, oi, retaddr, MO_LEQ, false,
return load_helper(env, addr, oi, retaddr, MO_LEQ, false, false,
helper_le_ldq_mmu);
}
uint64_t helper_be_ldq_mmu(CPUArchState *env, target_ulong addr,
TCGMemOpIdx oi, uintptr_t retaddr)
{
return load_helper(env, addr, oi, retaddr, MO_BEQ, false,
return load_helper(env, addr, oi, retaddr, MO_BEQ, false, false,
helper_be_ldq_mmu);
}
@ -1974,7 +1987,7 @@ void cpu_stq_le_data(CPUArchState *env, target_ulong ptr, uint64_t val)
static uint64_t full_ldub_code(CPUArchState *env, target_ulong addr,
TCGMemOpIdx oi, uintptr_t retaddr)
{
return load_helper(env, addr, oi, retaddr, MO_8, true, full_ldub_code);
return load_helper(env, addr, oi, retaddr, MO_8, true, true, full_ldub_code);
}
uint32_t cpu_ldub_code(CPUArchState *env, abi_ptr addr)
@ -1986,7 +1999,7 @@ uint32_t cpu_ldub_code(CPUArchState *env, abi_ptr addr)
static uint64_t full_lduw_code(CPUArchState *env, target_ulong addr,
TCGMemOpIdx oi, uintptr_t retaddr)
{
return load_helper(env, addr, oi, retaddr, MO_TEUW, true, full_lduw_code);
return load_helper(env, addr, oi, retaddr, MO_TEUW, true, true, full_lduw_code);
}
uint32_t cpu_lduw_code(CPUArchState *env, abi_ptr addr)
@ -1998,7 +2011,7 @@ uint32_t cpu_lduw_code(CPUArchState *env, abi_ptr addr)
static uint64_t full_ldl_code(CPUArchState *env, target_ulong addr,
TCGMemOpIdx oi, uintptr_t retaddr)
{
return load_helper(env, addr, oi, retaddr, MO_TEUL, true, full_ldl_code);
return load_helper(env, addr, oi, retaddr, MO_TEUL, true, true, full_ldl_code);
}
uint32_t cpu_ldl_code(CPUArchState *env, abi_ptr addr)
@ -2010,7 +2023,7 @@ uint32_t cpu_ldl_code(CPUArchState *env, abi_ptr addr)
static uint64_t full_ldq_code(CPUArchState *env, target_ulong addr,
TCGMemOpIdx oi, uintptr_t retaddr)
{
return load_helper(env, addr, oi, retaddr, MO_TEQ, true, full_ldq_code);
return load_helper(env, addr, oi, retaddr, MO_TEQ, true, true, full_ldq_code);
}
uint64_t cpu_ldq_code(CPUArchState *env, abi_ptr addr)
@ -2022,7 +2035,7 @@ uint64_t cpu_ldq_code(CPUArchState *env, abi_ptr addr)
static uint64_t full_ldub_cmmu(CPUArchState *env, target_ulong addr,
TCGMemOpIdx oi, uintptr_t retaddr)
{
return load_helper(env, addr, oi, retaddr, MO_8, true, full_ldub_cmmu);
return load_helper(env, addr, oi, retaddr, MO_8, true, true, full_ldub_cmmu);
}
uint8_t helper_ret_ldb_cmmu(CPUArchState *env, target_ulong addr,
@ -2034,7 +2047,7 @@ uint8_t helper_ret_ldb_cmmu(CPUArchState *env, target_ulong addr,
static uint64_t full_le_lduw_cmmu(CPUArchState *env, target_ulong addr,
TCGMemOpIdx oi, uintptr_t retaddr)
{
return load_helper(env, addr, oi, retaddr, MO_LEUW, true,
return load_helper(env, addr, oi, retaddr, MO_LEUW, true, true,
full_le_lduw_cmmu);
}
@ -2047,7 +2060,7 @@ uint16_t helper_le_ldw_cmmu(CPUArchState *env, target_ulong addr,
static uint64_t full_be_lduw_cmmu(CPUArchState *env, target_ulong addr,
TCGMemOpIdx oi, uintptr_t retaddr)
{
return load_helper(env, addr, oi, retaddr, MO_BEUW, true,
return load_helper(env, addr, oi, retaddr, MO_BEUW, true, true,
full_be_lduw_cmmu);
}
@ -2060,7 +2073,7 @@ uint16_t helper_be_ldw_cmmu(CPUArchState *env, target_ulong addr,
static uint64_t full_le_ldul_cmmu(CPUArchState *env, target_ulong addr,
TCGMemOpIdx oi, uintptr_t retaddr)
{
return load_helper(env, addr, oi, retaddr, MO_LEUL, true,
return load_helper(env, addr, oi, retaddr, MO_LEUL, true, true,
full_le_ldul_cmmu);
}
@ -2073,7 +2086,7 @@ uint32_t helper_le_ldl_cmmu(CPUArchState *env, target_ulong addr,
static uint64_t full_be_ldul_cmmu(CPUArchState *env, target_ulong addr,
TCGMemOpIdx oi, uintptr_t retaddr)
{
return load_helper(env, addr, oi, retaddr, MO_BEUL, true,
return load_helper(env, addr, oi, retaddr, MO_BEUL, true, true,
full_be_ldul_cmmu);
}
@ -2086,13 +2099,13 @@ uint32_t helper_be_ldl_cmmu(CPUArchState *env, target_ulong addr,
uint64_t helper_le_ldq_cmmu(CPUArchState *env, target_ulong addr,
TCGMemOpIdx oi, uintptr_t retaddr)
{
return load_helper(env, addr, oi, retaddr, MO_LEQ, true,
return load_helper(env, addr, oi, retaddr, MO_LEQ, true, true,
helper_le_ldq_cmmu);
}
uint64_t helper_be_ldq_cmmu(CPUArchState *env, target_ulong addr,
TCGMemOpIdx oi, uintptr_t retaddr)
{
return load_helper(env, addr, oi, retaddr, MO_BEQ, true,
return load_helper(env, addr, oi, retaddr, MO_BEQ, true, true,
helper_be_ldq_cmmu);
}

View file

@ -82,18 +82,15 @@ static void reset_temp(TCGContext *s, TCGArg arg)
reset_ts(arg_temp(arg));
}
/* Reset all temporaries, given that there are NB_TEMPS of them. */
static void reset_all_temps(TCGContext *s, int nb_temps)
/* Reset all temporaries */
static void reset_all_temps(TCGContext *s)
{
long len = BITS_TO_LONGS(nb_temps) * sizeof(unsigned long);
memset(&s->temps2_used.l, 0, len);
memset(&s->temps2_used, 0, sizeof(s->temps2_used));
}
/* Initialize and activate a temporary. */
static void init_ts_info(TCGContext *s, TCGTemp *ts)
static void init_ts_info(TCGContext *s, TCGTempSet *temps_used, TCGTemp *ts)
{
TCGTempSet *temps_used = &s->temps2_used;
TempOptInfo *ti;
size_t idx = temp_idx(s, ts);
@ -124,9 +121,9 @@ static void init_ts_info(TCGContext *s, TCGTemp *ts)
}
}
static void init_arg_info(TCGContext *s, TCGArg arg)
static void init_arg_info(TCGContext *s, TCGTempSet *temps_used, TCGArg arg)
{
init_ts_info(s, arg_temp(arg));
init_ts_info(s, temps_used, arg_temp(arg));
}
static TCGTemp *find_better_copy(TCGTemp *ts)
@ -181,38 +178,6 @@ static bool args_are_copies(TCGArg arg1, TCGArg arg2)
return ts_are_copies(arg_temp(arg1), arg_temp(arg2));
}
static void tcg_opt_gen_movi(TCGContext *s, TCGOp *op, TCGArg dst, uint64_t val)
{
const TCGOpDef *def;
TCGOpcode new_op;
uint64_t mask;
TempOptInfo *di = arg_info(dst);
def = &s->tcg_op_defs[op->opc];
if (def->flags & TCG_OPF_VECTOR) {
new_op = INDEX_op_dupi_vec;
} else if (def->flags & TCG_OPF_64BIT) {
new_op = INDEX_op_movi_i64;
} else {
new_op = INDEX_op_movi_i32;
}
op->opc = new_op;
/* TCGOP_VECL and TCGOP_VECE remain unchanged. */
op->args[0] = dst;
op->args[1] = val;
reset_temp(s, dst);
di->is_const = true;
di->val = val;
mask = val;
if (TCG_TARGET_REG_BITS > 32 && new_op == INDEX_op_movi_i32) {
/* High bits of the destination are now garbage. */
mask |= ~0xffffffffull;
}
di->mask = mask;
}
static void tcg_opt_gen_mov(TCGContext *s, TCGOp *op, TCGArg dst, TCGArg src)
{
TCGTemp *dst_ts = arg_temp(dst);
@ -264,6 +229,28 @@ static void tcg_opt_gen_mov(TCGContext *s, TCGOp *op, TCGArg dst, TCGArg src)
}
}
static void tcg_opt_gen_movi(TCGContext *s, TCGTempSet *temps_used,
TCGOp *op, TCGArg dst, uint64_t val)
{
const TCGOpDef *def = &s->tcg_op_defs[op->opc];
TCGType type;
TCGTemp *tv;
if (def->flags & TCG_OPF_VECTOR) {
type = TCGOP_VECL(op) + TCG_TYPE_V64;
} else if (def->flags & TCG_OPF_64BIT) {
type = TCG_TYPE_I64;
} else {
type = TCG_TYPE_I32;
}
/* Convert movi to mov with constant temp. */
tv = tcg_constant_internal(s, type, val);
init_ts_info(s, temps_used, tv);
tcg_opt_gen_mov(s, op, dst, temp_arg(tv));
}
static uint64_t do_constant_folding_2(TCGOpcode op, uint64_t x, uint64_t y)
{
uint64_t l64, h64;
@ -625,12 +612,14 @@ void tcg_optimize(TCGContext *s)
nb_temps = s->nb_temps;
nb_globals = s->nb_globals;
reset_all_temps(s, nb_temps);
reset_all_temps(s);
for (i = 0; i < nb_temps; ++i) {
s->temps[i].state_ptr = NULL;
}
TCGTempSet *temps_used = &s->temps2_used;
QTAILQ_FOREACH_SAFE(op, &s->ops, link, op_next) {
uint64_t mask, partmask, affected, tmp;
int nb_oargs, nb_iargs;
@ -645,14 +634,14 @@ void tcg_optimize(TCGContext *s)
for (i = 0; i < nb_oargs + nb_iargs; i++) {
TCGTemp *ts = arg_temp(op->args[i]);
if (ts) {
init_ts_info(s, ts);
init_ts_info(s, temps_used, ts);
}
}
} else {
nb_oargs = def->nb_oargs;
nb_iargs = def->nb_iargs;
for (i = 0; i < nb_oargs + nb_iargs; i++) {
init_arg_info(s, op->args[i]);
init_arg_info(s, temps_used, op->args[i]);
}
}
@ -731,7 +720,7 @@ void tcg_optimize(TCGContext *s)
CASE_OP_32_64(rotr):
if (arg_is_const(op->args[1])
&& arg_info(op->args[1])->val == 0) {
tcg_opt_gen_movi(s, op, op->args[0], 0);
tcg_opt_gen_movi(s, temps_used, op, op->args[0], 0);
continue;
}
break;
@ -1058,7 +1047,7 @@ void tcg_optimize(TCGContext *s)
if (partmask == 0) {
tcg_debug_assert(nb_oargs == 1);
tcg_opt_gen_movi(s, op, op->args[0], 0);
tcg_opt_gen_movi(s, temps_used, op, op->args[0], 0);
continue;
}
if (affected == 0) {
@ -1075,7 +1064,7 @@ void tcg_optimize(TCGContext *s)
CASE_OP_32_64(mulsh):
if (arg_is_const(op->args[2])
&& arg_info(op->args[2])->val == 0) {
tcg_opt_gen_movi(s, op, op->args[0], 0);
tcg_opt_gen_movi(s, temps_used, op, op->args[0], 0);
continue;
}
break;
@ -1102,7 +1091,7 @@ void tcg_optimize(TCGContext *s)
CASE_OP_32_64_VEC(sub):
CASE_OP_32_64_VEC(xor):
if (args_are_copies(op->args[1], op->args[2])) {
tcg_opt_gen_movi(s, op, op->args[0], 0);
tcg_opt_gen_movi(s, temps_used, op, op->args[0], 0);
continue;
}
break;
@ -1119,14 +1108,14 @@ void tcg_optimize(TCGContext *s)
break;
CASE_OP_32_64(movi):
case INDEX_op_dupi_vec:
tcg_opt_gen_movi(s, op, op->args[0], op->args[1]);
tcg_opt_gen_movi(s, temps_used, op, op->args[0], op->args[1]);
break;
case INDEX_op_dup_vec:
if (arg_is_const(op->args[1])) {
tmp = arg_info(op->args[1])->val;
tmp = dup_const(TCGOP_VECE(op), tmp);
tcg_opt_gen_movi(s, op, op->args[0], tmp);
tcg_opt_gen_movi(s, temps_used, op, op->args[0], tmp);
break;
}
goto do_default;
@ -1136,7 +1125,7 @@ void tcg_optimize(TCGContext *s)
if (arg_is_const(op->args[1]) && arg_is_const(op->args[2])) {
tmp = arg_info(op->args[1])->val;
if (tmp == arg_info(op->args[2])->val) {
tcg_opt_gen_movi(s, op, op->args[0], tmp);
tcg_opt_gen_movi(s, temps_used, op, op->args[0], tmp);
break;
}
} else if (args_are_copies(op->args[1], op->args[2])) {
@ -1164,7 +1153,7 @@ void tcg_optimize(TCGContext *s)
case INDEX_op_extrh_i64_i32:
if (arg_is_const(op->args[1])) {
tmp = do_constant_folding(s, opc, arg_info(op->args[1])->val, 0);
tcg_opt_gen_movi(s, op, op->args[0], tmp);
tcg_opt_gen_movi(s, temps_used, op, op->args[0], tmp);
break;
}
goto do_default;
@ -1194,7 +1183,7 @@ void tcg_optimize(TCGContext *s)
if (arg_is_const(op->args[1]) && arg_is_const(op->args[2])) {
tmp = do_constant_folding(s, opc, arg_info(op->args[1])->val,
arg_info(op->args[2])->val);
tcg_opt_gen_movi(s, op, op->args[0], tmp);
tcg_opt_gen_movi(s, temps_used, op, op->args[0], tmp);
break;
}
goto do_default;
@ -1205,7 +1194,7 @@ void tcg_optimize(TCGContext *s)
TCGArg v = arg_info(op->args[1])->val;
if (v != 0) {
tmp = do_constant_folding(s, opc, v, 0);
tcg_opt_gen_movi(s, op, op->args[0], tmp);
tcg_opt_gen_movi(s, temps_used, op, op->args[0], tmp);
} else {
tcg_opt_gen_mov(s, op, op->args[0], op->args[2]);
}
@ -1218,7 +1207,7 @@ void tcg_optimize(TCGContext *s)
tmp = deposit64(arg_info(op->args[1])->val,
op->args[3], op->args[4],
arg_info(op->args[2])->val);
tcg_opt_gen_movi(s, op, op->args[0], tmp);
tcg_opt_gen_movi(s, temps_used, op, op->args[0], tmp);
break;
}
goto do_default;
@ -1227,7 +1216,7 @@ void tcg_optimize(TCGContext *s)
if (arg_is_const(op->args[1])) {
tmp = extract64(arg_info(op->args[1])->val,
op->args[2], op->args[3]);
tcg_opt_gen_movi(s, op, op->args[0], tmp);
tcg_opt_gen_movi(s, temps_used, op, op->args[0], tmp);
break;
}
goto do_default;
@ -1236,7 +1225,7 @@ void tcg_optimize(TCGContext *s)
if (arg_is_const(op->args[1])) {
tmp = sextract64(arg_info(op->args[1])->val,
op->args[2], op->args[3]);
tcg_opt_gen_movi(s, op, op->args[0], tmp);
tcg_opt_gen_movi(s, temps_used, op, op->args[0], tmp);
break;
}
goto do_default;
@ -1253,7 +1242,7 @@ void tcg_optimize(TCGContext *s)
tmp = (int32_t)(((uint32_t)v1 >> shr) |
((uint32_t)v2 << (32 - shr)));
}
tcg_opt_gen_movi(s, op, op->args[0], tmp);
tcg_opt_gen_movi(s, temps_used, op, op->args[0], tmp);
break;
}
goto do_default;
@ -1262,7 +1251,7 @@ void tcg_optimize(TCGContext *s)
tmp = do_constant_folding_cond(s, opc, op->args[1],
op->args[2], op->args[3]);
if (tmp != 2) {
tcg_opt_gen_movi(s, op, op->args[0], tmp);
tcg_opt_gen_movi(s, temps_used, op, op->args[0], tmp);
break;
}
goto do_default;
@ -1272,7 +1261,7 @@ void tcg_optimize(TCGContext *s)
op->args[1], op->args[2]);
if (tmp != 2) {
if (tmp) {
reset_all_temps(s, nb_temps);
reset_all_temps(s);
op->opc = INDEX_op_br;
op->args[0] = op->args[3];
} else {
@ -1318,7 +1307,7 @@ void tcg_optimize(TCGContext *s)
uint64_t a = ((uint64_t)ah << 32) | al;
uint64_t b = ((uint64_t)bh << 32) | bl;
TCGArg rl, rh;
TCGOp *op2 = tcg_op_insert_before(s, op, INDEX_op_movi_i32);
TCGOp *op2 = tcg_op_insert_before(s, op, INDEX_op_mov_i32);
if (opc == INDEX_op_add2_i32) {
a += b;
@ -1328,8 +1317,8 @@ void tcg_optimize(TCGContext *s)
rl = op->args[0];
rh = op->args[1];
tcg_opt_gen_movi(s, op, rl, (int32_t)a);
tcg_opt_gen_movi(s, op2, rh, (int32_t)(a >> 32));
tcg_opt_gen_movi(s, temps_used, op, rl, (int32_t)a);
tcg_opt_gen_movi(s, temps_used, op2, rh, (int32_t)(a >> 32));
break;
}
goto do_default;
@ -1340,12 +1329,12 @@ void tcg_optimize(TCGContext *s)
uint32_t b = arg_info(op->args[3])->val;
uint64_t r = (uint64_t)a * b;
TCGArg rl, rh;
TCGOp *op2 = tcg_op_insert_before(s, op, INDEX_op_movi_i32);
TCGOp *op2 = tcg_op_insert_before(s, op, INDEX_op_mov_i32);
rl = op->args[0];
rh = op->args[1];
tcg_opt_gen_movi(s, op, rl, (int32_t)r);
tcg_opt_gen_movi(s, op2, rh, (int32_t)(r >> 32));
tcg_opt_gen_movi(s, temps_used, op, rl, (int32_t)r);
tcg_opt_gen_movi(s, temps_used, op2, rh, (int32_t)(r >> 32));
break;
}
goto do_default;
@ -1356,7 +1345,7 @@ void tcg_optimize(TCGContext *s)
if (tmp != 2) {
if (tmp) {
do_brcond_true:
reset_all_temps(s, nb_temps);
reset_all_temps(s);
op->opc = INDEX_op_br;
op->args[0] = op->args[5];
} else {
@ -1372,7 +1361,7 @@ void tcg_optimize(TCGContext *s)
/* Simplify LT/GE comparisons vs zero to a single compare
vs the high word of the input. */
do_brcond_high:
reset_all_temps(s, nb_temps);
reset_all_temps(s);
op->opc = INDEX_op_brcond_i32;
op->args[0] = op->args[1];
op->args[1] = op->args[3];
@ -1398,7 +1387,7 @@ void tcg_optimize(TCGContext *s)
goto do_default;
}
do_brcond_low:
reset_all_temps(s, nb_temps);
reset_all_temps(s);
op->opc = INDEX_op_brcond_i32;
op->args[1] = op->args[2];
op->args[2] = op->args[4];
@ -1433,7 +1422,7 @@ void tcg_optimize(TCGContext *s)
op->args[5]);
if (tmp != 2) {
do_setcond_const:
tcg_opt_gen_movi(s, op, op->args[0], tmp);
tcg_opt_gen_movi(s, temps_used, op, op->args[0], tmp);
} else if ((op->args[5] == TCG_COND_LT
|| op->args[5] == TCG_COND_GE)
&& arg_is_const(op->args[3])
@ -1518,7 +1507,7 @@ void tcg_optimize(TCGContext *s)
block, otherwise we only trash the output args. "mask" is
the non-zero bits mask for the first output arg. */
if (def->flags & TCG_OPF_BB_END) {
reset_all_temps(s, nb_temps);
reset_all_temps(s);
} else {
do_reset_output:
for (i = 0; i < nb_oargs; i++) {