tcg: Correct special-cased brcond handling

This commit is contained in:
Lioncash 2019-04-26 10:23:43 -04:00
parent 4a64ebf95e
commit f0c271ca2f
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -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)
{