tcg: Split out more subroutines from liveness_pass_1

Backports commit f65a061c39cc4f9d088201031050e42eb23d5b2a from qemu
This commit is contained in:
Richard Henderson 2019-01-05 07:07:48 -05:00 committed by Lioncash
parent c348ceba56
commit 63cf164724
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -1918,6 +1918,26 @@ static inline void tcg_la_br_end(TCGContext *s)
}
}
/* liveness analysis: sync globals back to memory. */
static void la_global_sync(TCGContext *s, int ng)
{
int i;
for (i = 0; i < ng; ++i) {
s->temps[i].state |= TS_MEM;
}
}
/* liveness analysis: sync globals back to memory and kill. */
static void la_global_kill(TCGContext *s, int ng)
{
int i;
for (i = 0; i < ng; i++) {
s->temps[i].state = TS_DEAD | TS_MEM;
}
}
/* Liveness analysis : update the opc_arg_life array to tell if a
given input arguments is dead. Instructions updating dead
temporaries are removed. */
@ -1973,15 +1993,9 @@ static void liveness_pass_1(TCGContext *s)
if (!(call_flags & (TCG_CALL_NO_WRITE_GLOBALS |
TCG_CALL_NO_READ_GLOBALS))) {
/* globals should go back to memory */
for (i = 0; i < nb_globals; i++) {
s->temps[i].state = TS_DEAD | TS_MEM;
}
la_global_kill(s, nb_globals);
} else if (!(call_flags & TCG_CALL_NO_READ_GLOBALS)) {
/* globals should be synced to memory */
for (i = 0; i < nb_globals; i++) {
s->temps[i].state |= TS_MEM;
}
la_global_sync(s, nb_globals);
}
/* record arguments that die in this helper */
@ -2133,10 +2147,7 @@ static void liveness_pass_1(TCGContext *s)
tcg_la_br_end(s);
}
} else if (def->flags & TCG_OPF_SIDE_EFFECTS) {
/* globals should be synced to memory */
for (i = 0; i < nb_globals; i++) {
s->temps[i].state |= TS_MEM;
}
la_global_sync(s, nb_globals);
}
/* record arguments that die in this opcode */