diff options
author | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-08-18 20:25:54 +0000 |
---|---|---|
committer | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-08-18 20:25:54 +0000 |
commit | 747af5e778fd8703ab7c4c5bbf3cfaacbee6bb7f (patch) | |
tree | aaae6cbc02ac7bffabdd0d787362314965ff9d55 /gcc/haifa-sched.c | |
parent | ad99e708993275cfd0d666486d9c1b8bc7107416 (diff) | |
download | gcc-747af5e778fd8703ab7c4c5bbf3cfaacbee6bb7f.tar.gz |
* haifa-sched.c: Convert to target hooks. Macros replaced
are ISSUE_RATE, ADJUST_COST, ADJUST_PRIORITY, MD_SCHED_INIT,
MD_SCHED_REORDER, MD_SCHED_REORDER2, MD_SCHED_VARIABLE_ISSUE,
MD_SCHED_FINISH, and HAVE_cycle_display.
* target-def.h (TARGET_SCHED_ADJUST_COST,
TARGET_SCHED_ADJUST_PRIORITY, TARGET_SCHED_ISSUE_RATE,
TARGET_SCHED_VARIABLE_ISSUE, TARGET_SCHED_INIT,
TARGET_SCHED_FINISH, TARGET_SCHED_REORDER,
TARGET_SCHED_REORDER2, TARGET_SCHED_CYCLE_DISPLAY):
New hook #defines to be overridden.
(TARGET_SCHED): Bring them all together.
(TARGET_INITIALIZER): Update.
* target.h: Don't forward declare struct rtx_def. Use 'rtx'
instead of 'struct rtx_def *' throughout.
(struct sched): New set of hooks for the scheduler.
* Makefile.in (haifa-sched.o): Depend on target.h.
* doc/tm.texi: Document the new scheduler hooks, together in
their own section, instead of scattered around.
Fix a bunch of underfull/overfull hboxes.
* a29k.h, alpha.h, arm.h, c4x.h, convex.h, d30v.h, i386.h,
ia64.h, m32r.h, m88k.h, mips.h, pa.h, rs6000.h, s390.h, sh.h,
sparc.h: Don't define any of the old scheduler macros.
* a29k.c, alpha.c, arm.c, c4x.c, convex.c, d30v.c, i386.c,
ia64.c, m32r.c, m88k.c, mips.c, pa.c, rs6000.c, s390.c, sh.c,
sparc.c: Create hook functions from code extracted from
corresponding target header, or make existing hooks static, as
appropriate. Set the appropriate entries in targetm.
* alpha-protos.h, arm-protos.h, c4x-protos.h, d30v-protos.h,
i386-protos.h, ia64-protos.h, m32r-protos.h, pa-protos.h,
rs6000-protos.h, s390-protos.h, sparc-protos.h:
Remove prototypes for functions which are now static.
* d30v.h, d30v.c, m32r.h, m32r.c: Remove #ifdef HAIFA and
related gunk; the Haifa scheduler is now the only choice.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45009 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/haifa-sched.c')
-rw-r--r-- | gcc/haifa-sched.c | 89 |
1 files changed, 43 insertions, 46 deletions
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c index 46993fbb96e..9e32034cf48 100644 --- a/gcc/haifa-sched.c +++ b/gcc/haifa-sched.c @@ -148,6 +148,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "toplev.h" #include "recog.h" #include "sched-int.h" +#include "target.h" #ifdef INSN_SCHEDULING @@ -157,10 +158,6 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA static int issue_rate; -#ifndef ISSUE_RATE -#define ISSUE_RATE 1 -#endif - /* sched-verbose controls the amount of debugging output the scheduler prints. It is controlled by -fsched-verbose=N: N>0 and no -DSR : the output is directed to stderr. @@ -693,12 +690,10 @@ insn_cost (insn, link, used) if (LINK_COST_FREE (link)) cost = 0; -#ifdef ADJUST_COST - else if (!LINK_COST_ZERO (link)) + else if (!LINK_COST_ZERO (link) && targetm.sched.adjust_cost) { - int ncost = cost; + int ncost = (*targetm.sched.adjust_cost) (used, link, insn, cost); - ADJUST_COST (used, link, insn, ncost); if (ncost < 1) { LINK_COST_FREE (link) = 1; @@ -708,7 +703,7 @@ insn_cost (insn, link, used) LINK_COST_ZERO (link) = 1; cost = ncost; } -#endif + return cost; } @@ -952,7 +947,7 @@ ready_sort (ready) HAIFA_INLINE static void adjust_priority (prev) - rtx prev ATTRIBUTE_UNUSED; + rtx prev; { /* ??? There used to be code here to try and estimate how an insn affected register lifetimes, but it did it by looking at REG_DEAD @@ -961,9 +956,9 @@ adjust_priority (prev) Revisit when we have a machine model to work with and not before. */ -#ifdef ADJUST_PRIORITY - ADJUST_PRIORITY (prev); -#endif + if (targetm.sched.adjust_priority) + INSN_PRIORITY (prev) = + (*targetm.sched.adjust_priority) (prev, INSN_PRIORITY (prev)); } /* Clock at which the previous instruction was issued. */ @@ -1668,16 +1663,15 @@ schedule_block (b, rgn_n_insns) clear_units (); /* Allocate the ready list. */ - ready.veclen = rgn_n_insns + 1 + ISSUE_RATE; + ready.veclen = rgn_n_insns + 1 + issue_rate; ready.first = ready.veclen - 1; ready.vec = (rtx *) xmalloc (ready.veclen * sizeof (rtx)); ready.n_ready = 0; (*current_sched_info->init_ready_list) (&ready); -#ifdef MD_SCHED_INIT - MD_SCHED_INIT (sched_dump, sched_verbose, ready.veclen); -#endif + if (targetm.sched.md_init) + (*targetm.sched.md_init) (sched_dump, sched_verbose, ready.veclen); /* No insns scheduled in this block yet. */ last_scheduled_insn = 0; @@ -1706,10 +1700,8 @@ schedule_block (b, rgn_n_insns) list. */ queue_to_ready (&ready); -#ifdef HAVE_cycle_display - if (HAVE_cycle_display) - last = emit_insn_after (gen_cycle_display (GEN_INT (clock_var)), last); -#endif + if (sched_verbose && targetm.sched.cycle_display) + last = (*targetm.sched.cycle_display) (clock_var, last); if (ready.n_ready == 0) abort (); @@ -1725,12 +1717,13 @@ schedule_block (b, rgn_n_insns) /* Allow the target to reorder the list, typically for better instruction bundling. */ -#ifdef MD_SCHED_REORDER - MD_SCHED_REORDER (sched_dump, sched_verbose, ready_lastpos (&ready), - ready.n_ready, clock_var, can_issue_more); -#else - can_issue_more = issue_rate; -#endif + if (targetm.sched.reorder) + can_issue_more = + (*targetm.sched.reorder) (sched_dump, sched_verbose, + ready_lastpos (&ready), + &ready.n_ready, clock_var); + else + can_issue_more = issue_rate; if (sched_verbose) { @@ -1759,25 +1752,27 @@ schedule_block (b, rgn_n_insns) last_scheduled_insn = insn; last = move_insn (insn, last); -#ifdef MD_SCHED_VARIABLE_ISSUE - MD_SCHED_VARIABLE_ISSUE (sched_dump, sched_verbose, insn, - can_issue_more); -#else - can_issue_more--; -#endif + if (targetm.sched.variable_issue) + can_issue_more = + (*targetm.sched.variable_issue) (sched_dump, sched_verbose, + insn, can_issue_more); + else + can_issue_more--; schedule_insn (insn, &ready, clock_var); next: - ; -#ifdef MD_SCHED_REORDER2 - /* Sort the ready list based on priority. */ - if (ready.n_ready > 0) - ready_sort (&ready); - MD_SCHED_REORDER2 (sched_dump, sched_verbose, - ready.n_ready ? ready_lastpos (&ready) : NULL, - ready.n_ready, clock_var, can_issue_more); -#endif + if (targetm.sched.reorder2) + { + /* Sort the ready list based on priority. */ + if (ready.n_ready > 0) + ready_sort (&ready); + can_issue_more = + (*targetm.sched.reorder2) (sched_dump,sched_verbose, + ready.n_ready + ? ready_lastpos (&ready) : NULL, + &ready.n_ready, clock_var); + } } /* Debug info. */ @@ -1785,9 +1780,8 @@ schedule_block (b, rgn_n_insns) visualize_scheduled_insns (clock_var); } -#ifdef MD_SCHED_FINISH - MD_SCHED_FINISH (sched_dump, sched_verbose); -#endif + if (targetm.sched.md_finish) + (*targetm.sched.md_finish) (sched_dump, sched_verbose); /* Debug info. */ if (sched_verbose) @@ -1896,7 +1890,10 @@ sched_init (dump_file) ? stderr : dump_file); /* Initialize issue_rate. */ - issue_rate = ISSUE_RATE; + if (targetm.sched.issue_rate) + issue_rate = (*targetm.sched.issue_rate) (); + else + issue_rate = 1; /* We use LUID 0 for the fake insn (UID 0) which holds dependencies for pseudos which do not cross calls. */ |