mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-12-23 04:15:39 +00:00
tcg: Consolidate 3 bits into enum TCGTempKind
The temp_fixed, temp_global, temp_local bits are all related. Combine them into a single enumeration. Backports ee17db83d2dce35792e9bf03366af193e5e0e5c9
This commit is contained in:
parent
520ec7ca76
commit
30739864d2
|
@ -118,21 +118,21 @@ static TCGTemp *find_better_copy(TCGTemp *ts)
|
||||||
TCGTemp *i;
|
TCGTemp *i;
|
||||||
|
|
||||||
/* If this is already a global, we can't do better. */
|
/* If this is already a global, we can't do better. */
|
||||||
if (ts->temp_global) {
|
if (ts->kind >= TEMP_GLOBAL) {
|
||||||
return ts;
|
return ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search for a global first. */
|
/* Search for a global first. */
|
||||||
for (i = ts_info(ts)->next_copy; i != ts; i = ts_info(i)->next_copy) {
|
for (i = ts_info(ts)->next_copy; i != ts; i = ts_info(i)->next_copy) {
|
||||||
if (i->temp_global) {
|
if (i->kind >= TEMP_GLOBAL) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If it is a temp, search for a temp local. */
|
/* If it is a temp, search for a temp local. */
|
||||||
if (!ts->temp_local) {
|
if (ts->kind == TEMP_NORMAL) {
|
||||||
for (i = ts_info(ts)->next_copy; i != ts; i = ts_info(i)->next_copy) {
|
for (i = ts_info(ts)->next_copy; i != ts; i = ts_info(i)->next_copy) {
|
||||||
if (ts->temp_local) {
|
if (i->kind >= TEMP_LOCAL) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
120
qemu/tcg/tcg.c
120
qemu/tcg/tcg.c
|
@ -550,7 +550,7 @@ static inline TCGTemp *tcg_global_alloc(TCGContext *s)
|
||||||
tcg_debug_assert(s->nb_globals == s->nb_temps);
|
tcg_debug_assert(s->nb_globals == s->nb_temps);
|
||||||
s->nb_globals++;
|
s->nb_globals++;
|
||||||
ts = tcg_temp_alloc(s);
|
ts = tcg_temp_alloc(s);
|
||||||
ts->temp_global = 1;
|
ts->kind = TEMP_GLOBAL;
|
||||||
|
|
||||||
return ts;
|
return ts;
|
||||||
}
|
}
|
||||||
|
@ -567,7 +567,7 @@ static TCGTemp *tcg_global_reg_new_internal(TCGContext *s, TCGType type,
|
||||||
ts = tcg_global_alloc(s);
|
ts = tcg_global_alloc(s);
|
||||||
ts->base_type = type;
|
ts->base_type = type;
|
||||||
ts->type = type;
|
ts->type = type;
|
||||||
ts->fixed_reg = 1;
|
ts->kind = TEMP_FIXED;
|
||||||
ts->reg = reg;
|
ts->reg = reg;
|
||||||
ts->name = name;
|
ts->name = name;
|
||||||
tcg_regset_set_reg(s->reserved_regs, reg);
|
tcg_regset_set_reg(s->reserved_regs, reg);
|
||||||
|
@ -616,7 +616,7 @@ TCGTemp *tcg_global_mem_new_internal(TCGContext *s, TCGType type, TCGv_ptr base,
|
||||||
bigendian = 1;
|
bigendian = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!base_ts->fixed_reg) {
|
if (base_ts->kind != TEMP_FIXED) {
|
||||||
/* We do not support double-indirect registers. */
|
/* We do not support double-indirect registers. */
|
||||||
tcg_debug_assert(!base_ts->indirect_reg);
|
tcg_debug_assert(!base_ts->indirect_reg);
|
||||||
base_ts->indirect_base = 1;
|
base_ts->indirect_base = 1;
|
||||||
|
@ -663,6 +663,7 @@ TCGTemp *tcg_global_mem_new_internal(TCGContext *s, TCGType type, TCGv_ptr base,
|
||||||
|
|
||||||
TCGTemp *tcg_temp_new_internal(TCGContext *s, TCGType type, bool temp_local)
|
TCGTemp *tcg_temp_new_internal(TCGContext *s, TCGType type, bool temp_local)
|
||||||
{
|
{
|
||||||
|
TCGTempKind kind = temp_local ? TEMP_LOCAL : TEMP_NORMAL;
|
||||||
TCGTemp *ts;
|
TCGTemp *ts;
|
||||||
int idx, k;
|
int idx, k;
|
||||||
|
|
||||||
|
@ -675,7 +676,7 @@ TCGTemp *tcg_temp_new_internal(TCGContext *s, TCGType type, bool temp_local)
|
||||||
ts = &s->temps[idx];
|
ts = &s->temps[idx];
|
||||||
ts->temp_allocated = 1;
|
ts->temp_allocated = 1;
|
||||||
tcg_debug_assert(ts->base_type == type);
|
tcg_debug_assert(ts->base_type == type);
|
||||||
tcg_debug_assert(ts->temp_local == temp_local);
|
tcg_debug_assert(ts->kind == kind);
|
||||||
} else {
|
} else {
|
||||||
ts = tcg_temp_alloc(s);
|
ts = tcg_temp_alloc(s);
|
||||||
if (TCG_TARGET_REG_BITS == 32 && type == TCG_TYPE_I64) {
|
if (TCG_TARGET_REG_BITS == 32 && type == TCG_TYPE_I64) {
|
||||||
|
@ -684,18 +685,18 @@ TCGTemp *tcg_temp_new_internal(TCGContext *s, TCGType type, bool temp_local)
|
||||||
ts->base_type = type;
|
ts->base_type = type;
|
||||||
ts->type = TCG_TYPE_I32;
|
ts->type = TCG_TYPE_I32;
|
||||||
ts->temp_allocated = 1;
|
ts->temp_allocated = 1;
|
||||||
ts->temp_local = temp_local;
|
ts->kind = kind;
|
||||||
|
|
||||||
tcg_debug_assert(ts2 == ts + 1);
|
tcg_debug_assert(ts2 == ts + 1);
|
||||||
ts2->base_type = TCG_TYPE_I64;
|
ts2->base_type = TCG_TYPE_I64;
|
||||||
ts2->type = TCG_TYPE_I32;
|
ts2->type = TCG_TYPE_I32;
|
||||||
ts2->temp_allocated = 1;
|
ts2->temp_allocated = 1;
|
||||||
ts2->temp_local = temp_local;
|
ts2->kind = kind;
|
||||||
} else {
|
} else {
|
||||||
ts->base_type = type;
|
ts->base_type = type;
|
||||||
ts->type = type;
|
ts->type = type;
|
||||||
ts->temp_allocated = 1;
|
ts->temp_allocated = 1;
|
||||||
ts->temp_local = temp_local;
|
ts->kind = kind;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -751,12 +752,12 @@ void tcg_temp_free_internal(TCGContext *s, TCGTemp *ts)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tcg_debug_assert(ts->temp_global == 0);
|
tcg_debug_assert(ts->kind < TEMP_GLOBAL);
|
||||||
tcg_debug_assert(ts->temp_allocated != 0);
|
tcg_debug_assert(ts->temp_allocated != 0);
|
||||||
ts->temp_allocated = 0;
|
ts->temp_allocated = 0;
|
||||||
|
|
||||||
idx = temp_idx(s, ts);
|
idx = temp_idx(s, ts);
|
||||||
k = ts->base_type + (ts->temp_local ? TCG_TYPE_COUNT : 0);
|
k = ts->base_type + (ts->kind == TEMP_NORMAL ? 0 : TCG_TYPE_COUNT);
|
||||||
set_bit(idx, s->free_temps[k].l);
|
set_bit(idx, s->free_temps[k].l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1280,17 +1281,27 @@ void tcg_gen_callN(TCGContext *s, void *func, TCGTemp *ret, int nargs, TCGTemp *
|
||||||
static void tcg_reg_alloc_start(TCGContext *s)
|
static void tcg_reg_alloc_start(TCGContext *s)
|
||||||
{
|
{
|
||||||
int i, n;
|
int i, n;
|
||||||
TCGTemp *ts;
|
|
||||||
|
|
||||||
for (i = 0, n = s->nb_globals; i < n; i++) {
|
for (i = 0, n = s->nb_temps; i < n; i++) {
|
||||||
ts = &s->temps[i];
|
TCGTemp *ts = &s->temps[i];
|
||||||
ts->val_type = (ts->fixed_reg ? TEMP_VAL_REG : TEMP_VAL_MEM);
|
TCGTempVal val = TEMP_VAL_MEM;
|
||||||
}
|
|
||||||
for (n = s->nb_temps; i < n; i++) {
|
switch (ts->kind) {
|
||||||
ts = &s->temps[i];
|
case TEMP_FIXED:
|
||||||
ts->val_type = (ts->temp_local ? TEMP_VAL_MEM : TEMP_VAL_DEAD);
|
val = TEMP_VAL_REG;
|
||||||
|
break;
|
||||||
|
case TEMP_GLOBAL:
|
||||||
|
break;
|
||||||
|
case TEMP_NORMAL:
|
||||||
|
val = TEMP_VAL_DEAD;
|
||||||
|
/* fall through */
|
||||||
|
case TEMP_LOCAL:
|
||||||
ts->mem_allocated = 0;
|
ts->mem_allocated = 0;
|
||||||
ts->fixed_reg = 0;
|
break;
|
||||||
|
default:
|
||||||
|
g_assert_not_reached();
|
||||||
|
}
|
||||||
|
ts->val_type = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(s->reg_to_temp, 0, sizeof(s->reg_to_temp));
|
memset(s->reg_to_temp, 0, sizeof(s->reg_to_temp));
|
||||||
|
@ -1301,12 +1312,17 @@ static char *tcg_get_arg_str_ptr(TCGContext *s, char *buf, int buf_size,
|
||||||
{
|
{
|
||||||
int idx = temp_idx(s, ts);
|
int idx = temp_idx(s, ts);
|
||||||
|
|
||||||
if (ts->temp_global) {
|
switch (ts->kind) {
|
||||||
|
case TEMP_FIXED:
|
||||||
|
case TEMP_GLOBAL:
|
||||||
pstrcpy(buf, buf_size, ts->name);
|
pstrcpy(buf, buf_size, ts->name);
|
||||||
} else if (ts->temp_local) {
|
break;
|
||||||
|
case TEMP_LOCAL:
|
||||||
snprintf(buf, buf_size, "loc%d", idx - s->nb_globals);
|
snprintf(buf, buf_size, "loc%d", idx - s->nb_globals);
|
||||||
} else {
|
break;
|
||||||
|
case TEMP_NORMAL:
|
||||||
snprintf(buf, buf_size, "tmp%d", idx - s->nb_globals);
|
snprintf(buf, buf_size, "tmp%d", idx - s->nb_globals);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
@ -1897,15 +1913,24 @@ static void la_bb_end(TCGContext *s, int ng, int nt)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < ng; ++i) {
|
for (i = 0; i < nt; ++i) {
|
||||||
s->temps[i].state = TS_DEAD | TS_MEM;
|
TCGTemp *ts = &s->temps[i];
|
||||||
la_reset_pref(s, &s->temps[i]);
|
int state;
|
||||||
|
|
||||||
|
switch (ts->kind) {
|
||||||
|
case TEMP_FIXED:
|
||||||
|
case TEMP_GLOBAL:
|
||||||
|
case TEMP_LOCAL:
|
||||||
|
state = TS_DEAD | TS_MEM;
|
||||||
|
break;
|
||||||
|
case TEMP_NORMAL:
|
||||||
|
state = TS_DEAD;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
g_assert_not_reached();
|
||||||
}
|
}
|
||||||
for (i = ng; i < nt; ++i) {
|
ts->state = state;
|
||||||
s->temps[i].state = (s->temps[i].temp_local
|
la_reset_pref(s, ts);
|
||||||
? TS_DEAD | TS_MEM
|
|
||||||
: TS_DEAD);
|
|
||||||
la_reset_pref(s, &s->temps[i]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1944,7 +1969,7 @@ static inline void tcg_la_br_end(TCGContext *s)
|
||||||
|
|
||||||
la_global_sync(s, ng);
|
la_global_sync(s, ng);
|
||||||
for (i = ng; i < nt; i++) {
|
for (i = ng; i < nt; i++) {
|
||||||
s->temps[i].state = s->temps[i].temp_local ? TS_DEAD | TS_MEM
|
s->temps[i].state = s->temps[i].kind == TEMP_LOCAL ? TS_DEAD | TS_MEM
|
||||||
: TS_MEM;
|
: TS_MEM;
|
||||||
la_reset_pref(s, &s->temps[i]);
|
la_reset_pref(s, &s->temps[i]);
|
||||||
}
|
}
|
||||||
|
@ -2542,7 +2567,8 @@ static void check_regs(TCGContext *s)
|
||||||
}
|
}
|
||||||
for (k = 0; k < s->nb_temps; k++) {
|
for (k = 0; k < s->nb_temps; k++) {
|
||||||
ts = &s->temps[k];
|
ts = &s->temps[k];
|
||||||
if (ts->val_type == TEMP_VAL_REG && !ts->fixed_reg
|
if (ts->val_type == TEMP_VAL_REG
|
||||||
|
&& ts->kind != TEMP_FIXED
|
||||||
&& s->reg_to_temp[ts->reg] != ts) {
|
&& s->reg_to_temp[ts->reg] != ts) {
|
||||||
printf("Inconsistency for temp %s:\n",
|
printf("Inconsistency for temp %s:\n",
|
||||||
tcg_get_arg_str_ptr(s, buf, sizeof(buf), ts));
|
tcg_get_arg_str_ptr(s, buf, sizeof(buf), ts));
|
||||||
|
@ -2579,15 +2605,14 @@ static void temp_load(TCGContext *, TCGTemp *, TCGRegSet, TCGRegSet, TCGRegSet);
|
||||||
mark it free; otherwise mark it dead. */
|
mark it free; otherwise mark it dead. */
|
||||||
static void temp_free_or_dead(TCGContext *s, TCGTemp *ts, int free_or_dead)
|
static void temp_free_or_dead(TCGContext *s, TCGTemp *ts, int free_or_dead)
|
||||||
{
|
{
|
||||||
if (ts->fixed_reg) {
|
if (ts->kind == TEMP_FIXED) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ts->val_type == TEMP_VAL_REG) {
|
if (ts->val_type == TEMP_VAL_REG) {
|
||||||
s->reg_to_temp[ts->reg] = NULL;
|
s->reg_to_temp[ts->reg] = NULL;
|
||||||
}
|
}
|
||||||
ts->val_type = (free_or_dead < 0
|
ts->val_type = (free_or_dead < 0
|
||||||
|| ts->temp_local
|
|| ts->kind != TEMP_NORMAL
|
||||||
|| ts->temp_global
|
|
||||||
? TEMP_VAL_MEM : TEMP_VAL_DEAD);
|
? TEMP_VAL_MEM : TEMP_VAL_DEAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2604,7 +2629,7 @@ static inline void temp_dead(TCGContext *s, TCGTemp *ts)
|
||||||
static void temp_sync(TCGContext *s, TCGTemp *ts, TCGRegSet allocated_regs,
|
static void temp_sync(TCGContext *s, TCGTemp *ts, TCGRegSet allocated_regs,
|
||||||
TCGRegSet preferred_regs, int free_or_dead)
|
TCGRegSet preferred_regs, int free_or_dead)
|
||||||
{
|
{
|
||||||
if (ts->fixed_reg) {
|
if (ts->kind == TEMP_FIXED) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!ts->mem_coherent) {
|
if (!ts->mem_coherent) {
|
||||||
|
@ -2787,7 +2812,8 @@ static void temp_save(TCGContext *s, TCGTemp *ts, TCGRegSet allocated_regs)
|
||||||
{
|
{
|
||||||
/* The liveness analysis already ensures that globals are back
|
/* The liveness analysis already ensures that globals are back
|
||||||
in memory. Keep an tcg_debug_assert for safety. */
|
in memory. Keep an tcg_debug_assert for safety. */
|
||||||
tcg_debug_assert(ts->val_type == TEMP_VAL_MEM || ts->fixed_reg);
|
tcg_debug_assert(ts->val_type == TEMP_VAL_MEM
|
||||||
|
|| ts->kind == TEMP_FIXED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* save globals to their canonical location and assume they can be
|
/* save globals to their canonical location and assume they can be
|
||||||
|
@ -2812,7 +2838,7 @@ static void sync_globals(TCGContext *s, TCGRegSet allocated_regs)
|
||||||
for (i = 0, n = s->nb_globals; i < n; i++) {
|
for (i = 0, n = s->nb_globals; i < n; i++) {
|
||||||
TCGTemp *ts = &s->temps[i];
|
TCGTemp *ts = &s->temps[i];
|
||||||
tcg_debug_assert(ts->val_type != TEMP_VAL_REG
|
tcg_debug_assert(ts->val_type != TEMP_VAL_REG
|
||||||
|| ts->fixed_reg
|
|| ts->kind == TEMP_FIXED
|
||||||
|| ts->mem_coherent);
|
|| ts->mem_coherent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2825,7 +2851,7 @@ static void tcg_reg_alloc_bb_end(TCGContext *s, TCGRegSet allocated_regs)
|
||||||
|
|
||||||
for (i = s->nb_globals; i < s->nb_temps; i++) {
|
for (i = s->nb_globals; i < s->nb_temps; i++) {
|
||||||
TCGTemp *ts = &s->temps[i];
|
TCGTemp *ts = &s->temps[i];
|
||||||
if (ts->temp_local) {
|
if (ts->kind == TEMP_LOCAL) {
|
||||||
temp_save(s, ts, allocated_regs);
|
temp_save(s, ts, allocated_regs);
|
||||||
} else {
|
} else {
|
||||||
/* The liveness analysis already ensures that temps are dead.
|
/* The liveness analysis already ensures that temps are dead.
|
||||||
|
@ -2845,7 +2871,7 @@ static void tcg_reg_alloc_do_movi(TCGContext *s, TCGTemp *ots,
|
||||||
TCGRegSet preferred_regs)
|
TCGRegSet preferred_regs)
|
||||||
{
|
{
|
||||||
/* ENV should not be modified. */
|
/* ENV should not be modified. */
|
||||||
tcg_debug_assert(!ots->fixed_reg);
|
tcg_debug_assert(ots->kind != TEMP_FIXED);
|
||||||
|
|
||||||
/* The movi is not explicitly generated here. */
|
/* The movi is not explicitly generated here. */
|
||||||
if (ots->val_type == TEMP_VAL_REG) {
|
if (ots->val_type == TEMP_VAL_REG) {
|
||||||
|
@ -2885,7 +2911,7 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TCGOp *op)
|
||||||
ts = arg_temp(op->args[1]);
|
ts = arg_temp(op->args[1]);
|
||||||
|
|
||||||
/* ENV should not be modified. */
|
/* ENV should not be modified. */
|
||||||
tcg_debug_assert(!ots->fixed_reg);
|
tcg_debug_assert(ots->kind != TEMP_FIXED);
|
||||||
|
|
||||||
/* Note that otype != itype for no-op truncation. */
|
/* Note that otype != itype for no-op truncation. */
|
||||||
otype = ots->type;
|
otype = ots->type;
|
||||||
|
@ -2924,7 +2950,7 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TCGOp *op)
|
||||||
}
|
}
|
||||||
temp_dead(s, ots);
|
temp_dead(s, ots);
|
||||||
} else {
|
} else {
|
||||||
if (IS_DEAD_ARG(1) && !ts->fixed_reg) {
|
if (IS_DEAD_ARG(1) && ts->kind != TEMP_FIXED) {
|
||||||
/* the mov can be suppressed */
|
/* the mov can be suppressed */
|
||||||
if (ots->val_type == TEMP_VAL_REG) {
|
if (ots->val_type == TEMP_VAL_REG) {
|
||||||
s->reg_to_temp[ots->reg] = NULL;
|
s->reg_to_temp[ots->reg] = NULL;
|
||||||
|
@ -2946,7 +2972,7 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TCGOp *op)
|
||||||
* Store the source register into the destination slot
|
* Store the source register into the destination slot
|
||||||
* and leave the destination temp as TEMP_VAL_MEM.
|
* and leave the destination temp as TEMP_VAL_MEM.
|
||||||
*/
|
*/
|
||||||
assert(!ots->fixed_reg);
|
assert(ots->kind != TEMP_FIXED);
|
||||||
if (!ts->mem_allocated) {
|
if (!ts->mem_allocated) {
|
||||||
temp_allocate_frame(s, ots);
|
temp_allocate_frame(s, ots);
|
||||||
}
|
}
|
||||||
|
@ -2983,7 +3009,7 @@ static void tcg_reg_alloc_dup(TCGContext *s, const TCGOp *op)
|
||||||
its = arg_temp(op->args[1]);
|
its = arg_temp(op->args[1]);
|
||||||
|
|
||||||
/* ENV should not be modified. */
|
/* ENV should not be modified. */
|
||||||
tcg_debug_assert(!ots->fixed_reg);
|
tcg_debug_assert(ots->kind != TEMP_FIXED);
|
||||||
|
|
||||||
itype = its->type;
|
itype = its->type;
|
||||||
vece = TCGOP_VECE(op);
|
vece = TCGOP_VECE(op);
|
||||||
|
@ -3123,7 +3149,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op)
|
||||||
i_preferred_regs = o_preferred_regs = 0;
|
i_preferred_regs = o_preferred_regs = 0;
|
||||||
if (arg_ct->ialias) {
|
if (arg_ct->ialias) {
|
||||||
o_preferred_regs = op->output_pref[arg_ct->alias_index];
|
o_preferred_regs = op->output_pref[arg_ct->alias_index];
|
||||||
if (ts->fixed_reg) {
|
if (ts->kind == TEMP_FIXED) {
|
||||||
/* if fixed register, we must allocate a new register
|
/* if fixed register, we must allocate a new register
|
||||||
if the alias is not the same register */
|
if the alias is not the same register */
|
||||||
if (arg != op->args[arg_ct->alias_index]) {
|
if (arg != op->args[arg_ct->alias_index]) {
|
||||||
|
@ -3213,7 +3239,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op)
|
||||||
ts = arg_temp(arg);
|
ts = arg_temp(arg);
|
||||||
|
|
||||||
/* ENV should not be modified. */
|
/* ENV should not be modified. */
|
||||||
tcg_debug_assert(!ts->fixed_reg);
|
tcg_debug_assert(ts->kind != TEMP_FIXED);
|
||||||
|
|
||||||
if (arg_ct->oalias && !const_args[arg_ct->alias_index]) {
|
if (arg_ct->oalias && !const_args[arg_ct->alias_index]) {
|
||||||
reg = new_args[arg_ct->alias_index];
|
reg = new_args[arg_ct->alias_index];
|
||||||
|
@ -3254,7 +3280,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op)
|
||||||
ts = arg_temp(op->args[i]);
|
ts = arg_temp(op->args[i]);
|
||||||
|
|
||||||
/* ENV should not be modified. */
|
/* ENV should not be modified. */
|
||||||
tcg_debug_assert(!ts->fixed_reg);
|
tcg_debug_assert(ts->kind != TEMP_FIXED);
|
||||||
|
|
||||||
if (NEED_SYNC_ARG(i)) {
|
if (NEED_SYNC_ARG(i)) {
|
||||||
temp_sync(s, ts, o_allocated_regs, 0, IS_DEAD_ARG(i));
|
temp_sync(s, ts, o_allocated_regs, 0, IS_DEAD_ARG(i));
|
||||||
|
@ -3386,7 +3412,7 @@ static void tcg_reg_alloc_call(TCGContext *s, TCGOp *op)
|
||||||
ts = arg_temp(arg);
|
ts = arg_temp(arg);
|
||||||
|
|
||||||
/* ENV should not be modified. */
|
/* ENV should not be modified. */
|
||||||
tcg_debug_assert(!ts->fixed_reg);
|
tcg_debug_assert(ts->kind != TEMP_FIXED);
|
||||||
|
|
||||||
reg = tcg_target_call_oarg_regs[i];
|
reg = tcg_target_call_oarg_regs[i];
|
||||||
tcg_debug_assert(s->reg_to_temp[reg] == NULL);
|
tcg_debug_assert(s->reg_to_temp[reg] == NULL);
|
||||||
|
|
|
@ -490,23 +490,27 @@ typedef enum TCGTempVal {
|
||||||
TEMP_VAL_CONST,
|
TEMP_VAL_CONST,
|
||||||
} TCGTempVal;
|
} TCGTempVal;
|
||||||
|
|
||||||
|
typedef enum TCGTempKind {
|
||||||
|
/* Temp is dead at the end of all basic blocks. */
|
||||||
|
TEMP_NORMAL,
|
||||||
|
/* Temp is saved across basic blocks but dead at the end of TBs. */
|
||||||
|
TEMP_LOCAL,
|
||||||
|
/* Temp is saved across both basic blocks and translation blocks. */
|
||||||
|
TEMP_GLOBAL,
|
||||||
|
/* Temp is in a fixed register. */
|
||||||
|
TEMP_FIXED,
|
||||||
|
} TCGTempKind;
|
||||||
|
|
||||||
typedef struct TCGTemp {
|
typedef struct TCGTemp {
|
||||||
TCGReg reg:8;
|
TCGReg reg:8;
|
||||||
TCGTempVal val_type:8;
|
TCGTempVal val_type:8;
|
||||||
TCGType base_type:8;
|
TCGType base_type:8;
|
||||||
TCGType type:8;
|
TCGType type:8;
|
||||||
unsigned int fixed_reg:1;
|
TCGTempKind kind:3;
|
||||||
unsigned int indirect_reg:1;
|
unsigned int indirect_reg:1;
|
||||||
unsigned int indirect_base:1;
|
unsigned int indirect_base:1;
|
||||||
unsigned int mem_coherent:1;
|
unsigned int mem_coherent:1;
|
||||||
unsigned int mem_allocated:1;
|
unsigned int mem_allocated:1;
|
||||||
/* If true, the temp is saved across both basic blocks and
|
|
||||||
translation blocks. */
|
|
||||||
unsigned int temp_global:1;
|
|
||||||
/* If true, the temp is saved across basic blocks but dead
|
|
||||||
at the end of translation blocks. If false, the temp is
|
|
||||||
dead at the end of basic blocks. */
|
|
||||||
unsigned int temp_local:1;
|
|
||||||
unsigned int temp_allocated:1;
|
unsigned int temp_allocated:1;
|
||||||
|
|
||||||
tcg_target_long val;
|
tcg_target_long val;
|
||||||
|
|
Loading…
Reference in a new issue