mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-26 21:41:17 +00:00
tcg: Require liveness analysis
Backports commit c0ef05b5e62ab0c291a94022f14104e61e306f03 from qemu
This commit is contained in:
parent
541601edc4
commit
8a012ff6d3
|
@ -23,7 +23,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* define it to use liveness analysis (better code) */
|
/* define it to use liveness analysis (better code) */
|
||||||
#define USE_LIVENESS_ANALYSIS
|
|
||||||
#define USE_TCG_OPTIMIZATIONS
|
#define USE_TCG_OPTIMIZATIONS
|
||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
|
@ -1383,8 +1382,6 @@ void tcg_op_remove(TCGContext *s, TCGOp *op)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_LIVENESS_ANALYSIS
|
|
||||||
|
|
||||||
#define TS_DEAD 1
|
#define TS_DEAD 1
|
||||||
#define TS_MEM 2
|
#define TS_MEM 2
|
||||||
|
|
||||||
|
@ -1668,18 +1665,6 @@ static void tcg_liveness_analysis(TCGContext *s)
|
||||||
op->life = arg_life;
|
op->life = arg_life;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
/* dummy liveness analysis */
|
|
||||||
static void tcg_liveness_analysis(TCGContext *s)
|
|
||||||
{
|
|
||||||
int nb_ops = s->gen_next_op_idx;
|
|
||||||
|
|
||||||
s->op_dead_args = tcg_malloc(s, nb_ops * sizeof(uint16_t));
|
|
||||||
memset(s->op_dead_args, 0, nb_ops * sizeof(uint16_t));
|
|
||||||
s->op_sync_args = tcg_malloc(s, nb_ops * sizeof(uint8_t));
|
|
||||||
memset(s->op_sync_args, 0, nb_ops * sizeof(uint8_t));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_TCG
|
#ifdef CONFIG_DEBUG_TCG
|
||||||
static void dump_regs(TCGContext *s)
|
static void dump_regs(TCGContext *s)
|
||||||
|
@ -1931,7 +1916,6 @@ static void temp_load(TCGContext *s, TCGTemp *ts, TCGRegSet desired_regs,
|
||||||
temporary registers needs to be allocated to store a constant. */
|
temporary registers needs to be allocated to store a constant. */
|
||||||
static void temp_save(TCGContext *s, TCGTemp *ts, TCGRegSet allocated_regs)
|
static void temp_save(TCGContext *s, TCGTemp *ts, TCGRegSet allocated_regs)
|
||||||
{
|
{
|
||||||
#ifdef USE_LIVENESS_ANALYSIS
|
|
||||||
/* ??? Liveness does not yet incorporate indirect bases. */
|
/* ??? Liveness does not yet incorporate indirect bases. */
|
||||||
if (!ts->indirect_base) {
|
if (!ts->indirect_base) {
|
||||||
/* The liveness analysis already ensures that globals are back
|
/* The liveness analysis already ensures that globals are back
|
||||||
|
@ -1939,7 +1923,6 @@ static void temp_save(TCGContext *s, TCGTemp *ts, TCGRegSet allocated_regs)
|
||||||
tcg_debug_assert(ts->val_type == TEMP_VAL_MEM || ts->fixed_reg);
|
tcg_debug_assert(ts->val_type == TEMP_VAL_MEM || ts->fixed_reg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
temp_sync(s, ts, allocated_regs, 1);
|
temp_sync(s, ts, allocated_regs, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1964,7 +1947,6 @@ static void sync_globals(TCGContext *s, TCGRegSet allocated_regs)
|
||||||
|
|
||||||
for (i = 0; i < s->nb_globals; i++) {
|
for (i = 0; i < s->nb_globals; i++) {
|
||||||
TCGTemp *ts = &s->temps[i];
|
TCGTemp *ts = &s->temps[i];
|
||||||
#ifdef USE_LIVENESS_ANALYSIS
|
|
||||||
/* ??? Liveness does not yet incorporate indirect bases. */
|
/* ??? Liveness does not yet incorporate indirect bases. */
|
||||||
if (!ts->indirect_base) {
|
if (!ts->indirect_base) {
|
||||||
tcg_debug_assert(ts->val_type != TEMP_VAL_REG
|
tcg_debug_assert(ts->val_type != TEMP_VAL_REG
|
||||||
|
@ -1972,7 +1954,6 @@ static void sync_globals(TCGContext *s, TCGRegSet allocated_regs)
|
||||||
|| ts->mem_coherent);
|
|| ts->mem_coherent);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
temp_sync(s, ts, allocated_regs, 0);
|
temp_sync(s, ts, allocated_regs, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1988,7 +1969,6 @@ static void tcg_reg_alloc_bb_end(TCGContext *s, TCGRegSet allocated_regs)
|
||||||
if (ts->temp_local) {
|
if (ts->temp_local) {
|
||||||
temp_save(s, ts, allocated_regs);
|
temp_save(s, ts, allocated_regs);
|
||||||
} else {
|
} else {
|
||||||
#ifdef USE_LIVENESS_ANALYSIS
|
|
||||||
/* ??? Liveness does not yet incorporate indirect bases. */
|
/* ??? Liveness does not yet incorporate indirect bases. */
|
||||||
if (!ts->indirect_base) {
|
if (!ts->indirect_base) {
|
||||||
/* The liveness analysis already ensures that temps are dead.
|
/* The liveness analysis already ensures that temps are dead.
|
||||||
|
@ -1996,7 +1976,6 @@ static void tcg_reg_alloc_bb_end(TCGContext *s, TCGRegSet allocated_regs)
|
||||||
tcg_debug_assert(ts->val_type == TEMP_VAL_DEAD);
|
tcg_debug_assert(ts->val_type == TEMP_VAL_DEAD);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
temp_dead(s, ts);
|
temp_dead(s, ts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue