From 815f70953280dac231e6229b69069b09ada503b8 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Sat, 3 Nov 2012 12:21:07 +0100 Subject: [PATCH] Simplify inserting the fxchs in x87_shuffle(). Always inserting before the cf node results in the same order as first inserting before the cf node and then inserting after the last inserted node. --- ir/be/ia32/ia32_x87.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/ir/be/ia32/ia32_x87.c b/ir/be/ia32/ia32_x87.c index 2b1e41a5b..b483c42d2 100644 --- a/ir/be/ia32/ia32_x87.c +++ b/ir/be/ia32/ia32_x87.c @@ -470,7 +470,6 @@ static x87_state *x87_shuffle(ir_node *block, x87_state *state, const x87_state int i, n_cycles, k, ri; unsigned cycles[4], all_mask; char cycle_idx[4][8]; - ir_node *fxch, *before, *after; assert(state->depth == dst_state->depth); @@ -546,39 +545,29 @@ static x87_state *x87_shuffle(ir_node *block, x87_state *state, const x87_state } #endif - after = NULL; - /* * Find the place node must be insert. * We have only one successor block, so the last instruction should * be a jump. */ - before = sched_last(block); + ir_node *const before = sched_last(block); assert(is_cfop(before)); /* now do the permutations */ for (ri = 0; ri < n_cycles; ++ri) { if ((cycles[ri] & 1) == 0) { /* this cycle does not include the tos */ - fxch = x87_fxch_shuffle(state, cycle_idx[ri][0], block); - if (after) - sched_add_after(after, fxch); - else - sched_add_before(before, fxch); - after = fxch; + ir_node *const fxch = x87_fxch_shuffle(state, cycle_idx[ri][0], block); + sched_add_before(before, fxch); } for (k = 1; cycle_idx[ri][k] != -1; ++k) { - fxch = x87_fxch_shuffle(state, cycle_idx[ri][k], block); - if (after) - sched_add_after(after, fxch); - else - sched_add_before(before, fxch); - after = fxch; + ir_node *const fxch = x87_fxch_shuffle(state, cycle_idx[ri][k], block); + sched_add_before(before, fxch); } if ((cycles[ri] & 1) == 0) { /* this cycle does not include the tos */ - fxch = x87_fxch_shuffle(state, cycle_idx[ri][0], block); - sched_add_after(after, fxch); + ir_node *const fxch = x87_fxch_shuffle(state, cycle_idx[ri][0], block); + sched_add_before(before, fxch); } } return state; -- 2.20.1