提交 e5097dc8 编写于 作者: B bellard

fixed dead global variable update

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4512 c046a42c-6fe2-441c-8c8c-71466251a162
上级 839bca84
...@@ -1293,10 +1293,9 @@ static int tcg_reg_alloc(TCGContext *s, TCGRegSet reg1, TCGRegSet reg2) ...@@ -1293,10 +1293,9 @@ static int tcg_reg_alloc(TCGContext *s, TCGRegSet reg1, TCGRegSet reg2)
tcg_abort(); tcg_abort();
} }
/* at the end of a basic block, we assume all temporaries are dead and /* save globals to their cannonical location and assume they can be
all globals are stored at their canonical location */ modified be the following code. */
/* XXX: optimize by handling constants in another array ? */ static void save_globals(TCGContext *s)
void tcg_reg_alloc_bb_end(TCGContext *s)
{ {
TCGTemp *ts; TCGTemp *ts;
int i; int i;
...@@ -1306,9 +1305,22 @@ void tcg_reg_alloc_bb_end(TCGContext *s) ...@@ -1306,9 +1305,22 @@ void tcg_reg_alloc_bb_end(TCGContext *s)
if (!ts->fixed_reg) { if (!ts->fixed_reg) {
if (ts->val_type == TEMP_VAL_REG) { if (ts->val_type == TEMP_VAL_REG) {
tcg_reg_free(s, ts->reg); tcg_reg_free(s, ts->reg);
} else if (ts->val_type == TEMP_VAL_DEAD) {
ts->val_type = TEMP_VAL_MEM;
} }
} }
} }
}
/* at the end of a basic block, we assume all temporaries are dead and
all globals are stored at their canonical location */
/* XXX: optimize by handling constants in another array ? */
void tcg_reg_alloc_bb_end(TCGContext *s)
{
TCGTemp *ts;
int i;
save_globals(s);
for(i = s->nb_globals; i < s->nb_temps; i++) { for(i = s->nb_globals; i < s->nb_temps; i++) {
ts = &s->temps[i]; ts = &s->temps[i];
...@@ -1481,14 +1493,7 @@ static void tcg_reg_alloc_op(TCGContext *s, ...@@ -1481,14 +1493,7 @@ static void tcg_reg_alloc_op(TCGContext *s,
/* store globals and free associated registers (we assume the insn /* store globals and free associated registers (we assume the insn
can modify any global. */ can modify any global. */
for(i = 0; i < s->nb_globals; i++) { save_globals(s);
ts = &s->temps[i];
if (!ts->fixed_reg) {
if (ts->val_type == TEMP_VAL_REG) {
tcg_reg_free(s, ts->reg);
}
}
}
} }
/* satisfy the output constraints */ /* satisfy the output constraints */
...@@ -1680,14 +1685,7 @@ static int tcg_reg_alloc_call(TCGContext *s, const TCGOpDef *def, ...@@ -1680,14 +1685,7 @@ static int tcg_reg_alloc_call(TCGContext *s, const TCGOpDef *def,
/* store globals and free associated registers (we assume the call /* store globals and free associated registers (we assume the call
can modify any global. */ can modify any global. */
for(i = 0; i < s->nb_globals; i++) { save_globals(s);
ts = &s->temps[i];
if (!ts->fixed_reg) {
if (ts->val_type == TEMP_VAL_REG) {
tcg_reg_free(s, ts->reg);
}
}
}
tcg_out_op(s, opc, &func_arg, &const_func_arg); tcg_out_op(s, opc, &func_arg, &const_func_arg);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册