diff options
author | bernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-03-01 13:21:30 +0000 |
---|---|---|
committer | bernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-03-01 13:21:30 +0000 |
commit | 89beeed35a9c65037942ca8dd6e033672f16f109 (patch) | |
tree | 49363554554ff466c0017de2e20bc441da32ac71 /gcc/haifa-sched.c | |
parent | 4d67aa45f4fe2e42283e13d181f7b575dbe42b37 (diff) | |
download | gcc-89beeed35a9c65037942ca8dd6e033672f16f109.tar.gz |
Avoid exponential runtime
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@40145 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/haifa-sched.c')
-rw-r--r-- | gcc/haifa-sched.c | 39 |
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 |