summaryrefslogtreecommitdiff
path: root/gcc/haifa-sched.c
diff options
context:
space:
mode:
authorBernd Schmidt <bernds@redhat.com>2001-03-01 13:21:30 +0000
committerBernd Schmidt <bernds@gcc.gnu.org>2001-03-01 13:21:30 +0000
commit21e4c9a8db052486c9baf381279d1725048a56f0 (patch)
tree49363554554ff466c0017de2e20bc441da32ac71 /gcc/haifa-sched.c
parentc2a3a48235e6a983585e0b5d07718faa68dd41b5 (diff)
downloadgcc-21e4c9a8db052486c9baf381279d1725048a56f0.tar.gz
Avoid exponential runtime
From-SVN: r40145
Diffstat (limited to 'gcc/haifa-sched.c')
-rw-r--r--gcc/haifa-sched.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index b4053b5e90c..977b6ecd297 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -719,38 +719,43 @@ static int
priority (insn)
rtx insn;
{
- int this_priority;
rtx link;
if (! INSN_P (insn))
return 0;
- if ((this_priority = INSN_PRIORITY (insn)) == 0)
+ if (! INSN_PRIORITY_KNOWN (insn))
{
+ int this_priority = 0;
+
if (INSN_DEPEND (insn) == 0)
this_priority = insn_cost (insn, 0, 0);
else
- for (link = INSN_DEPEND (insn); link; link = XEXP (link, 1))
- {
- rtx next;
- int next_priority;
+ {
+ for (link = INSN_DEPEND (insn); link; link = XEXP (link, 1))
+ {
+ rtx next;
+ int next_priority;
- if (RTX_INTEGRATED_P (link))
- continue;
+ if (RTX_INTEGRATED_P (link))
+ continue;
- next = XEXP (link, 0);
+ next = XEXP (link, 0);
- /* Critical path is meaningful in block boundaries only. */
- if (! (*current_sched_info->contributes_to_priority) (next, insn))
- continue;
+ /* Critical path is meaningful in block boundaries only. */
+ if (! (*current_sched_info->contributes_to_priority) (next, insn))
+ continue;
- next_priority = insn_cost (insn, link, next) + priority (next);
- if (next_priority > this_priority)
- this_priority = next_priority;
- }
+ next_priority = insn_cost (insn, link, next) + priority (next);
+ if (next_priority > this_priority)
+ this_priority = next_priority;
+ }
+ }
INSN_PRIORITY (insn) = this_priority;
+ INSN_PRIORITY_KNOWN (insn) = 1;
}
- return this_priority;
+
+ return INSN_PRIORITY (insn);
}
/* Macros and functions for keeping the priority queue sorted, and