Commit e883c09b authored by Christoph Mallon's avatar Christoph Mallon
Browse files

ia32: Improve the code genereated by x87_kill_deads().

To remove dead values from the fp stack, it is not necessary to generate any fxch instructions.
fstp can remove any value from the stack.
parent 7bde6856
......@@ -1364,26 +1364,23 @@ static void x87_kill_deads(x87_simulator *const sim, ir_node *const block, x87_s
}
/* now kill registers */
while (kill_mask != 0) {
/* we can only kill from TOS, so bring them up */
if ((kill_mask & 1) == 0) {
/* search from behind, because we can to a double-pop */
unsigned i;
for (i = depth; i-- > 0; ) {
unsigned i;
if (kill_mask & 1) {
/* Pop from TOS, if possible, looks nicer. */
i = 0;
} else {
/* Remove deepest dead value from stack, so TOS gets moved there and later
* more pops from TOS might follow. */
for (i = depth; i-- > 0;) {
if (kill_mask & (1 << i)) {
kill_mask &= ~(1 << i);
kill_mask |= 1;
break;
}
}
if (keep != NULL)
x87_set_st(state, -1, keep, i);
x87_create_fxch(state, first_insn, i);
}
keep = x87_create_fpop(state, first_insn, i);
depth -= 1;
kill_mask >>= 1;
keep = x87_create_fpop(state, first_insn, 0);
}
keep_alive(keep);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment