mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-03-24 22:15:07 +00:00
tcg: Change temp_sync argument to TCGTemp
Backports commit 12b9b11a2743002232098afb41810f1c0cb211a0 from qemu
This commit is contained in:
parent
82a4e93629
commit
2c3ad57215
|
@ -1791,29 +1791,28 @@ static inline void temp_dead(TCGContext *s, TCGTemp *ts)
|
||||||
|
|
||||||
/* sync a temporary to memory. 'allocated_regs' is used in case a
|
/* sync a temporary to memory. 'allocated_regs' is used in case a
|
||||||
temporary registers needs to be allocated to store a constant. */
|
temporary registers needs to be allocated to store a constant. */
|
||||||
static inline void temp_sync(TCGContext *s, int temp, TCGRegSet allocated_regs)
|
static void temp_sync(TCGContext *s, TCGTemp *ts, TCGRegSet allocated_regs)
|
||||||
{
|
{
|
||||||
TCGTemp *ts = &s->temps[temp];
|
if (ts->fixed_reg) {
|
||||||
|
return;
|
||||||
if (!ts->fixed_reg) {
|
}
|
||||||
switch(ts->val_type) {
|
switch (ts->val_type) {
|
||||||
case TEMP_VAL_CONST:
|
case TEMP_VAL_CONST:
|
||||||
ts->reg = tcg_reg_alloc(s, (TCGRegSet)s->tcg_target_available_regs[ts->type],
|
ts->reg = tcg_reg_alloc(s, s->tcg_target_available_regs[ts->type],
|
||||||
allocated_regs);
|
allocated_regs);
|
||||||
ts->val_type = TEMP_VAL_REG;
|
ts->val_type = TEMP_VAL_REG;
|
||||||
s->reg_to_temp[ts->reg] = ts;
|
s->reg_to_temp[ts->reg] = ts;
|
||||||
ts->mem_coherent = 0;
|
ts->mem_coherent = 0;
|
||||||
tcg_out_movi(s, ts->type, ts->reg, ts->val);
|
tcg_out_movi(s, ts->type, ts->reg, ts->val);
|
||||||
/* fallthrough*/
|
/* fallthrough*/
|
||||||
case TEMP_VAL_REG:
|
case TEMP_VAL_REG:
|
||||||
tcg_reg_sync(s, ts->reg);
|
tcg_reg_sync(s, ts->reg);
|
||||||
break;
|
break;
|
||||||
case TEMP_VAL_DEAD:
|
case TEMP_VAL_DEAD:
|
||||||
case TEMP_VAL_MEM:
|
case TEMP_VAL_MEM:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
tcg_abort();
|
tcg_abort();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1828,7 +1827,7 @@ static inline void temp_save(TCGContext *s, int temp, TCGRegSet allocated_regs)
|
||||||
in memory. Keep an assert for safety. */
|
in memory. Keep an 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->fixed_reg);
|
||||||
#else
|
#else
|
||||||
temp_sync(s, temp, allocated_regs);
|
temp_sync(s, ts, allocated_regs);
|
||||||
temp_dead(s, ts);
|
temp_dead(s, ts);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1853,11 +1852,13 @@ static void sync_globals(TCGContext *s, TCGRegSet allocated_regs)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < s->nb_globals; i++) {
|
for (i = 0; i < s->nb_globals; i++) {
|
||||||
|
TCGTemp *ts = &s->temps[i];
|
||||||
#ifdef USE_LIVENESS_ANALYSIS
|
#ifdef USE_LIVENESS_ANALYSIS
|
||||||
assert(s->temps[i].val_type != TEMP_VAL_REG || s->temps[i].fixed_reg ||
|
tcg_debug_assert(ts->val_type != TEMP_VAL_REG
|
||||||
s->temps[i].mem_coherent);
|
|| ts->fixed_reg
|
||||||
|
|| ts->mem_coherent);
|
||||||
#else
|
#else
|
||||||
temp_sync(s, i, allocated_regs);
|
temp_sync(s, ts, allocated_regs);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1912,7 +1913,7 @@ static void tcg_reg_alloc_movi(TCGContext *s, const TCGArg *args,
|
||||||
ots->val = val;
|
ots->val = val;
|
||||||
}
|
}
|
||||||
if (NEED_SYNC_ARG(0)) {
|
if (NEED_SYNC_ARG(0)) {
|
||||||
temp_sync(s, args[0], s->reserved_regs);
|
temp_sync(s, ots, s->reserved_regs);
|
||||||
}
|
}
|
||||||
if (IS_DEAD_ARG(0)) {
|
if (IS_DEAD_ARG(0)) {
|
||||||
temp_dead(s, ots);
|
temp_dead(s, ots);
|
||||||
|
|
Loading…
Reference in a new issue