Commit 05641603 by Bernd Schmidt Committed by Bernd Schmidt

haifa-sched.c (prune_ready_list): Rework handling of SCHED_GROUP_P insns so that…

haifa-sched.c (prune_ready_list): Rework handling of SCHED_GROUP_P insns so that no other insn is queued for a...

	* haifa-sched.c (prune_ready_list): Rework handling of SCHED_GROUP_P
	insns so that no other insn is queued for a time before them.

From-SVN: r186325
parent 7861732f
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
* sel-sched.c (sel_global_init): Swap order of sched_rgn_init and * sel-sched.c (sel_global_init): Swap order of sched_rgn_init and
sched_init calls. sched_init calls.
* haifa-sched.c (prune_ready_list): Rework handling of SCHED_GROUP_P
insns so that no other insn is queued for a time before them.
2012-04-11 Richard Guenther <rguenther@suse.de> 2012-04-11 Richard Guenther <rguenther@suse.de>
PR middle-end/52621 PR middle-end/52621
......
...@@ -3946,32 +3946,44 @@ static void ...@@ -3946,32 +3946,44 @@ static void
prune_ready_list (state_t temp_state, bool first_cycle_insn_p, prune_ready_list (state_t temp_state, bool first_cycle_insn_p,
bool shadows_only_p, bool modulo_epilogue_p) bool shadows_only_p, bool modulo_epilogue_p)
{ {
int i; int i, pass;
bool sched_group_found = false; bool sched_group_found = false;
int min_cost_group = 1;
restart:
for (i = 0; i < ready.n_ready; i++) for (i = 0; i < ready.n_ready; i++)
{ {
rtx insn = ready_element (&ready, i); rtx insn = ready_element (&ready, i);
if (SCHED_GROUP_P (insn))
{
sched_group_found = true;
break;
}
}
/* Make two passes if there's a SCHED_GROUP_P insn; make sure to handle
such an insn first and note its cost, then schedule all other insns
for one cycle later. */
for (pass = sched_group_found ? 0 : 1; pass < 2; )
{
int n = ready.n_ready;
for (i = 0; i < n; i++)
{
rtx insn = ready_element (&ready, i);
int cost = 0; int cost = 0;
const char *reason = "resource conflict"; const char *reason = "resource conflict";
if (DEBUG_INSN_P (insn)) if (DEBUG_INSN_P (insn))
continue; continue;
if (SCHED_GROUP_P (insn) && !sched_group_found)
{
sched_group_found = true;
if (i > 0)
goto restart;
}
if (sched_group_found && !SCHED_GROUP_P (insn)) if (sched_group_found && !SCHED_GROUP_P (insn))
{ {
cost = 1; if (pass == 0)
continue;
cost = min_cost_group;
reason = "not in sched group"; reason = "not in sched group";
} }
else if (modulo_epilogue_p && INSN_EXACT_TICK (insn) == INVALID_TICK) else if (modulo_epilogue_p
&& INSN_EXACT_TICK (insn) == INVALID_TICK)
{ {
cost = max_insn_queue_index; cost = max_insn_queue_index;
reason = "not an epilogue insn"; reason = "not an epilogue insn";
...@@ -4024,10 +4036,16 @@ prune_ready_list (state_t temp_state, bool first_cycle_insn_p, ...@@ -4024,10 +4036,16 @@ prune_ready_list (state_t temp_state, bool first_cycle_insn_p,
} }
if (cost >= 1) if (cost >= 1)
{ {
if (SCHED_GROUP_P (insn) && cost > min_cost_group)
min_cost_group = cost;
ready_remove (&ready, i); ready_remove (&ready, i);
queue_insn (insn, cost, reason); queue_insn (insn, cost, reason);
goto restart; if (i + 1 < n)
break;
}
} }
if (i == n)
pass++;
} }
} }
......
Markdown is supported
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