mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-02-25 17:16:55 +00:00
tcg: Remove tcg_regset_set
Backports commit d21369f5fb41299d5e7b032ec6da12da7f95f72f from qemu
This commit is contained in:
parent
49d09d6888
commit
7ba6f6f5e6
|
@ -195,11 +195,11 @@ static const char *target_parse_constraint(TCGArgConstraint *ct,
|
|||
switch(*ct_str++) {
|
||||
case 'r':
|
||||
ct->ct |= TCG_CT_REG;
|
||||
tcg_regset_set(ct->u.regs, 0xffffffff);
|
||||
ct->u.regs = 0xffffffff;
|
||||
break;
|
||||
case 'L': /* qemu_ld input arg constraint */
|
||||
ct->ct |= TCG_CT_REG;
|
||||
tcg_regset_set(ct->u.regs, 0xffffffff);
|
||||
ct->u.regs = 0xffffffff;
|
||||
tcg_regset_reset_reg(ct->u.regs, TCG_REG_A0);
|
||||
#if defined(CONFIG_SOFTMMU)
|
||||
if (TCG_TARGET_REG_BITS < TARGET_LONG_BITS) {
|
||||
|
@ -209,7 +209,7 @@ static const char *target_parse_constraint(TCGArgConstraint *ct,
|
|||
break;
|
||||
case 'S': /* qemu_st constraint */
|
||||
ct->ct |= TCG_CT_REG;
|
||||
tcg_regset_set(ct->u.regs, 0xffffffff);
|
||||
ct->u.regs = 0xffffffff;
|
||||
tcg_regset_reset_reg(ct->u.regs, TCG_REG_A0);
|
||||
#if defined(CONFIG_SOFTMMU)
|
||||
if (TCG_TARGET_REG_BITS < TARGET_LONG_BITS) {
|
||||
|
@ -2622,11 +2622,11 @@ static void tcg_target_qemu_prologue(TCGContext *s)
|
|||
static void tcg_target_init(TCGContext *s)
|
||||
{
|
||||
tcg_target_detect_isa();
|
||||
tcg_regset_set(s->tcg_target_available_regs[TCG_TYPE_I32], 0xffffffff);
|
||||
s->tcg_target_available_regs[TCG_TYPE_I32] = 0xffffffff;
|
||||
if (TCG_TARGET_REG_BITS == 64) {
|
||||
tcg_regset_set(s->tcg_target_available_regs[TCG_TYPE_I64], 0xffffffff);
|
||||
s->tcg_target_available_regs[TCG_TYPE_I64] = 0xffffffff;
|
||||
}
|
||||
tcg_regset_set(s->tcg_target_call_clobber_regs,
|
||||
s->tcg_target_call_clobber_regs =
|
||||
(1 << TCG_REG_V0) |
|
||||
(1 << TCG_REG_V1) |
|
||||
(1 << TCG_REG_A0) |
|
||||
|
@ -2642,7 +2642,7 @@ static void tcg_target_init(TCGContext *s)
|
|||
(1 << TCG_REG_T6) |
|
||||
(1 << TCG_REG_T7) |
|
||||
(1 << TCG_REG_T8) |
|
||||
(1 << TCG_REG_T9));
|
||||
(1 << TCG_REG_T9);
|
||||
|
||||
s->reserved_regs = 0;
|
||||
tcg_regset_set_reg(s->reserved_regs, TCG_REG_ZERO); /* zero register */
|
||||
|
|
|
@ -2441,7 +2441,7 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TCGOpDef *def,
|
|||
TCGTemp *ts, *ots;
|
||||
TCGType otype, itype;
|
||||
|
||||
tcg_regset_set(allocated_regs, s->reserved_regs);
|
||||
allocated_regs = s->reserved_regs;
|
||||
ots = &s->temps[args[0]];
|
||||
ts = &s->temps[args[1]];
|
||||
|
||||
|
@ -2511,7 +2511,6 @@ static void tcg_reg_alloc_op(TCGContext *s,
|
|||
const TCGOpDef *def, TCGOpcode opc,
|
||||
const TCGArg *args, TCGLifeData arg_life)
|
||||
{
|
||||
TCGRegSet allocated_regs;
|
||||
TCGRegSet i_allocated_regs;
|
||||
TCGRegSet o_allocated_regs;
|
||||
int i, k, nb_iargs, nb_oargs;
|
||||
|
@ -2530,8 +2529,8 @@ static void tcg_reg_alloc_op(TCGContext *s,
|
|||
args + nb_oargs + nb_iargs,
|
||||
sizeof(TCGArg) * def->nb_cargs);
|
||||
|
||||
tcg_regset_set(i_allocated_regs, s->reserved_regs);
|
||||
tcg_regset_set(o_allocated_regs, s->reserved_regs);
|
||||
i_allocated_regs = s->reserved_regs;
|
||||
o_allocated_regs = s->reserved_regs;
|
||||
|
||||
/* satisfy input constraints */
|
||||
for(k = 0; k < nb_iargs; k++) {
|
||||
|
@ -2550,7 +2549,6 @@ static void tcg_reg_alloc_op(TCGContext *s,
|
|||
|
||||
temp_load(s, ts, arg_ct->u.regs, i_allocated_regs);
|
||||
|
||||
assert(ts->val_type == TEMP_VAL_REG);
|
||||
if (arg_ct->ct & TCG_CT_IALIAS) {
|
||||
if (ts->fixed_reg) {
|
||||
/* if fixed register, we must allocate a new register
|
||||
|
@ -2564,6 +2562,16 @@ static void tcg_reg_alloc_op(TCGContext *s,
|
|||
if (!IS_DEAD_ARG(i)) {
|
||||
goto allocate_in_reg;
|
||||
}
|
||||
/* check if the current register has already been allocated
|
||||
for another input aliased to an output */
|
||||
int k2, i2;
|
||||
for (k2 = 0 ; k2 < k ; k2++) {
|
||||
i2 = def->sorted_args[nb_oargs + k2];
|
||||
if ((def->args_ct[i2].ct & TCG_CT_IALIAS) &&
|
||||
(new_args[i2] == ts->reg)) {
|
||||
goto allocate_in_reg;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
reg = ts->reg;
|
||||
|
@ -2595,7 +2603,7 @@ static void tcg_reg_alloc_op(TCGContext *s,
|
|||
} else {
|
||||
if (def->flags & TCG_OPF_CALL_CLOBBER) {
|
||||
/* XXX: permit generic clobber register list ? */
|
||||
for(i = 0; i < TCG_TARGET_NB_REGS; i++) {
|
||||
for (i = 0; i < TCG_TARGET_NB_REGS; i++) {
|
||||
if (tcg_regset_test_reg(s->tcg_target_call_clobber_regs, i)) {
|
||||
tcg_reg_free(s, i, i_allocated_regs);
|
||||
}
|
||||
|
@ -2608,7 +2616,6 @@ static void tcg_reg_alloc_op(TCGContext *s,
|
|||
}
|
||||
|
||||
/* satisfy the output constraints */
|
||||
tcg_regset_set(allocated_regs, s->reserved_regs);
|
||||
for(k = 0; k < nb_oargs; k++) {
|
||||
i = def->sorted_args[k];
|
||||
arg = args[i];
|
||||
|
@ -2727,7 +2734,7 @@ static void tcg_reg_alloc_call(TCGContext *s, int nb_oargs, int nb_iargs,
|
|||
}
|
||||
|
||||
/* assign input registers */
|
||||
tcg_regset_set(allocated_regs, s->reserved_regs);
|
||||
allocated_regs = s->reserved_regs;
|
||||
for(i = 0; i < nb_regs; i++) {
|
||||
arg = args[nb_oargs + i];
|
||||
if (arg != TCG_CALL_DUMMY_ARG) {
|
||||
|
|
|
@ -189,7 +189,6 @@ typedef enum TCGOpcode {
|
|||
NB_OPS,
|
||||
} TCGOpcode;
|
||||
|
||||
#define tcg_regset_set(d, s) (d) = (s)
|
||||
#define tcg_regset_set32(d, reg, val32) (d) |= (val32) << (reg)
|
||||
#define tcg_regset_set_reg(d, r) (d) |= 1L << (r)
|
||||
#define tcg_regset_reset_reg(d, r) (d) &= ~(1L << (r))
|
||||
|
|
Loading…
Reference in a new issue