From f0c271ca2f7aef0af1f8385d44a34d27cd53d821 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 26 Apr 2019 10:23:43 -0400 Subject: [PATCH] tcg: Correct special-cased brcond handling --- qemu/tcg/tcg.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/qemu/tcg/tcg.c b/qemu/tcg/tcg.c index d9b8a9c5..8d743ef7 100644 --- a/qemu/tcg/tcg.c +++ b/qemu/tcg/tcg.c @@ -1878,23 +1878,6 @@ static void la_bb_end(TCGContext *s, int ng, int nt) } } -/* - Unicorn: for brcond, we should refresh liveness states for TCG globals -*/ -static inline void tcg_la_br_end(TCGContext *s) -{ - int ng = s->nb_globals; - int nt = s->nb_temps; - int i; - - for (i = 0; i < ng; i++) { - s->temps[i].state = TS_MEM; - } - for(i = ng; i < nt; i++) { - s->temps[i].state = s->temps[i].temp_local; - } -} - /* liveness analysis: sync globals back to memory. */ static void la_global_sync(TCGContext *s, int ng) { @@ -1921,6 +1904,21 @@ static void la_global_kill(TCGContext *s, int ng) } } +/* Unicorn: for brcond, we should refresh liveness states for TCG globals */ +static inline void tcg_la_br_end(TCGContext *s) +{ + int ng = s->nb_globals; + int nt = s->nb_temps; + int i; + + la_global_sync(s, ng); + for (i = ng; i < nt; i++) { + s->temps[i].state = s->temps[i].temp_local ? TS_DEAD | TS_MEM + : TS_MEM; + la_reset_pref(s, &s->temps[i]); + } +} + /* liveness analysis: note live globals crossing calls. */ static void la_cross_call(TCGContext *s, int nt) {