summaryrefslogtreecommitdiff
path: root/gcc/haifa-sched.c
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>1998-06-05 11:32:28 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>1998-06-05 11:32:28 +0000
commit02aef853c7064f105433cc7b657c565964231eaa (patch)
tree8b7b568cba192b365198f55d2e5552643d76ee81 /gcc/haifa-sched.c
parent84b8ac06f23c6c720d3d23d882f65fa77a9b853a (diff)
downloadgcc-02aef853c7064f105433cc7b657c565964231eaa.tar.gz
* haifa-sched.c (rank_for_schedule): For "equally good insns", prefer
the insn which has the most insns dependent on it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@20243 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/haifa-sched.c')
-rw-r--r--gcc/haifa-sched.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 1c5245c2d86..fed2a129f9a 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -87,7 +87,8 @@
broken by
6. choose insn with the least dependences upon the previously
scheduled insn, or finally
- 7. choose insn with lowest UID.
+ 7 choose the insn which has the most insns dependent on it.
+ 8. choose insn with lowest UID.
Memory references complicate matters. Only if we can be certain
that memory references are not part of the data dependency graph
@@ -4029,7 +4030,7 @@ rank_for_schedule (x, y)
rtx tmp = *(rtx *)y;
rtx tmp2 = *(rtx *)x;
rtx link;
- int tmp_class, tmp2_class;
+ int tmp_class, tmp2_class, depend_count1, depend_count2;
int val, priority_val, spec_val, prob_val, weight_val;
@@ -4090,6 +4091,21 @@ rank_for_schedule (x, y)
return val;
}
+ /* Prefer the insn which has more later insns that depend on it.
+ This gives the scheduler more freedom when scheduling later
+ instructions at the expense of added register pressure. */
+ depend_count1 = 0;
+ for (link = INSN_DEPEND (tmp); link; link = XEXP (link, 1))
+ depend_count1++;
+
+ depend_count2 = 0;
+ for (link = INSN_DEPEND (tmp2); link; link = XEXP (link, 1))
+ depend_count2++;
+
+ val = depend_count2 - depend_count1;
+ if (val)
+ return val;
+
/* If insns are equally good, sort by INSN_LUID (original insn order),
so that we make the sort stable. This minimizes instruction movement,
thus minimizing sched's effect on debugging and cross-jumping. */