tcg: Rename and adjust liveness_pass_1 helpers

No need for a "tcg_" prefix for a static function; we already
have another "la_" prefix for indicating liveness analysis.
Pass in nb_globals and nb_temps, as we will already have them
in registers for other loops within the parent function.

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

View file

@ -1873,10 +1873,8 @@ static void reachable_code_pass(TCGContext *s)
/* liveness analysis: end of function: all temps are dead, and globals /* liveness analysis: end of function: all temps are dead, and globals
should be in memory. */ should be in memory. */
static inline void tcg_la_func_end(TCGContext *s) static void la_func_end(TCGContext *s, int ng, int nt)
{ {
int ng = s->nb_globals;
int nt = s->nb_temps;
int i; int i;
for (i = 0; i < ng; ++i) { for (i = 0; i < ng; ++i) {
@ -1889,10 +1887,8 @@ static inline void tcg_la_func_end(TCGContext *s)
/* liveness analysis: end of basic block: all temps are dead, globals /* liveness analysis: end of basic block: all temps are dead, globals
and local temps should be in memory. */ and local temps should be in memory. */
static void tcg_la_bb_end(TCGContext *s) static void la_bb_end(TCGContext *s, int ng, int nt)
{ {
int ng = s->nb_globals;
int nt = s->nb_temps;
int i; int i;
for (i = 0; i < ng; ++i) { for (i = 0; i < ng; ++i) {
@ -1928,9 +1924,10 @@ static inline void tcg_la_br_end(TCGContext *s)
static void liveness_pass_1(TCGContext *s) static void liveness_pass_1(TCGContext *s)
{ {
int nb_globals = s->nb_globals; int nb_globals = s->nb_globals;
int nb_temps = s->nb_temps;
TCGOp *op, *op_prev; TCGOp *op, *op_prev;
tcg_la_func_end(s); la_func_end(s, nb_globals, nb_temps);
QTAILQ_FOREACH_REVERSE_SAFE(op, &s->ops, TCGOpHead, link, op_prev) { QTAILQ_FOREACH_REVERSE_SAFE(op, &s->ops, TCGOpHead, link, op_prev) {
int i, nb_iargs, nb_oargs; int i, nb_iargs, nb_oargs;
@ -2126,7 +2123,7 @@ static void liveness_pass_1(TCGContext *s)
// brcond instruction in the middle of the TB, // brcond instruction in the middle of the TB,
// which incorrectly flags end-of-block // which incorrectly flags end-of-block
if (opc != INDEX_op_brcond_i32) { if (opc != INDEX_op_brcond_i32) {
tcg_la_bb_end(s); la_bb_end(s, nb_globals, nb_temps);
} else { } else {
// Unicorn: we do not touch dead temps for brcond, // Unicorn: we do not touch dead temps for brcond,
// but we should refresh TCG globals In-Memory states, // but we should refresh TCG globals In-Memory states,