1997-08-12 06:07:19 +02:00
|
|
|
|
/* Instruction scheduling pass.
|
2000-02-26 14:55:09 +01:00
|
|
|
|
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998,
|
2002-01-18 14:40:36 +01:00
|
|
|
|
1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
1997-08-12 06:07:19 +02:00
|
|
|
|
Contributed by Michael Tiemann (tiemann@cygnus.com) Enhanced by,
|
|
|
|
|
and currently maintained by, Jim Wilson (wilson@cygnus.com)
|
|
|
|
|
|
Makefile.in, [...]: replace "GNU CC" with "GCC".
* Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c,
bitmap.h, builtin-types.def, builtins.c, builtins.def,
c-aux-info.c, c-common.c, c-common.def, c-common.h,
c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c,
c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in,
c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c,
caller-save.c, calls.c, collect2.c, collect2.h, combine.c,
conditions.h, config.gcc, configure.frag, configure.in,
conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c,
cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h,
dependence.c, df.c, df.h, diagnostic.c, diagnostic.h,
doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c,
dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c,
emit-rtl.c, errors.c, errors.h, except.c, except.h,
exgettext, explow.c, expmed.c, expr.c, expr.h, final.c,
fixproto, flags.h, flow.c, fold-const.c, fp-test.c,
function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp,
gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c,
gencheck.c, gencodes.c, genconfig.c, genemit.c,
genextract.c, genflags.c, gengenrtl.c, genmultilib,
genopinit.c, genoutput.c, genpeep.c, genrecog.c,
gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c,
ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c,
graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h,
gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h,
gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h,
hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h,
integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c,
libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h,
machmode.def, machmode.h, main.c, mbchar.c, mbchar.h,
mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk,
mkmap-symver.awk, optabs.c, output.h, params.c, params.def,
params.h, predict.c, predict.def, predict.h, prefix.c,
prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c,
read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c,
regclass.c, regmove.c, regrename.c, regs.h, reload.c,
reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c,
rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h,
sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c,
sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c,
ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c,
stringpool.c, system.h, timevar.c, timevar.def, timevar.h,
tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h,
tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h,
unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h,
unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c,
xcoffout.h: replace "GNU CC" with "GCC".
From-SVN: r45105
2001-08-22 16:35:51 +02:00
|
|
|
|
This file is part of GCC.
|
2000-04-20 12:55:19 +02:00
|
|
|
|
|
Makefile.in, [...]: replace "GNU CC" with "GCC".
* Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c,
bitmap.h, builtin-types.def, builtins.c, builtins.def,
c-aux-info.c, c-common.c, c-common.def, c-common.h,
c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c,
c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in,
c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c,
caller-save.c, calls.c, collect2.c, collect2.h, combine.c,
conditions.h, config.gcc, configure.frag, configure.in,
conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c,
cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h,
dependence.c, df.c, df.h, diagnostic.c, diagnostic.h,
doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c,
dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c,
emit-rtl.c, errors.c, errors.h, except.c, except.h,
exgettext, explow.c, expmed.c, expr.c, expr.h, final.c,
fixproto, flags.h, flow.c, fold-const.c, fp-test.c,
function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp,
gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c,
gencheck.c, gencodes.c, genconfig.c, genemit.c,
genextract.c, genflags.c, gengenrtl.c, genmultilib,
genopinit.c, genoutput.c, genpeep.c, genrecog.c,
gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c,
ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c,
graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h,
gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h,
gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h,
hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h,
integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c,
libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h,
machmode.def, machmode.h, main.c, mbchar.c, mbchar.h,
mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk,
mkmap-symver.awk, optabs.c, output.h, params.c, params.def,
params.h, predict.c, predict.def, predict.h, prefix.c,
prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c,
read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c,
regclass.c, regmove.c, regrename.c, regs.h, reload.c,
reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c,
rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h,
sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c,
sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c,
ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c,
stringpool.c, system.h, timevar.c, timevar.def, timevar.h,
tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h,
tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h,
unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h,
unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c,
xcoffout.h: replace "GNU CC" with "GCC".
From-SVN: r45105
2001-08-22 16:35:51 +02:00
|
|
|
|
GCC is free software; you can redistribute it and/or modify it under
|
|
|
|
|
the terms of the GNU General Public License as published by the Free
|
|
|
|
|
Software Foundation; either version 2, or (at your option) any later
|
|
|
|
|
version.
|
2000-04-20 12:55:19 +02:00
|
|
|
|
|
Makefile.in, [...]: replace "GNU CC" with "GCC".
* Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c,
bitmap.h, builtin-types.def, builtins.c, builtins.def,
c-aux-info.c, c-common.c, c-common.def, c-common.h,
c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c,
c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in,
c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c,
caller-save.c, calls.c, collect2.c, collect2.h, combine.c,
conditions.h, config.gcc, configure.frag, configure.in,
conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c,
cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h,
dependence.c, df.c, df.h, diagnostic.c, diagnostic.h,
doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c,
dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c,
emit-rtl.c, errors.c, errors.h, except.c, except.h,
exgettext, explow.c, expmed.c, expr.c, expr.h, final.c,
fixproto, flags.h, flow.c, fold-const.c, fp-test.c,
function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp,
gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c,
gencheck.c, gencodes.c, genconfig.c, genemit.c,
genextract.c, genflags.c, gengenrtl.c, genmultilib,
genopinit.c, genoutput.c, genpeep.c, genrecog.c,
gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c,
ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c,
graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h,
gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h,
gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h,
hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h,
integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c,
libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h,
machmode.def, machmode.h, main.c, mbchar.c, mbchar.h,
mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk,
mkmap-symver.awk, optabs.c, output.h, params.c, params.def,
params.h, predict.c, predict.def, predict.h, prefix.c,
prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c,
read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c,
regclass.c, regmove.c, regrename.c, regs.h, reload.c,
reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c,
rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h,
sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c,
sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c,
ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c,
stringpool.c, system.h, timevar.c, timevar.def, timevar.h,
tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h,
tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h,
unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h,
unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c,
xcoffout.h: replace "GNU CC" with "GCC".
From-SVN: r45105
2001-08-22 16:35:51 +02:00
|
|
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
2000-04-20 12:55:19 +02:00
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
|
for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2001-09-14 13:05:39 +02:00
|
|
|
|
along with GCC; see the file COPYING. If not, write to the Free
|
|
|
|
|
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
2000-04-20 12:55:19 +02:00
|
|
|
|
02111-1307, USA. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
/* Instruction scheduling pass. This file, along with sched-deps.c,
|
|
|
|
|
contains the generic parts. The actual entry point is found for
|
|
|
|
|
the normal instruction scheduling pass is found in sched-rgn.c.
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
|
|
|
|
We compute insn priorities based on data dependencies. Flow
|
|
|
|
|
analysis only creates a fraction of the data-dependencies we must
|
|
|
|
|
observe: namely, only those dependencies which the combiner can be
|
|
|
|
|
expected to use. For this pass, we must therefore create the
|
|
|
|
|
remaining dependencies we need to observe: register dependencies,
|
|
|
|
|
memory dependencies, dependencies to keep function calls in order,
|
|
|
|
|
and the dependence between a conditional branch and the setting of
|
|
|
|
|
condition codes are all dealt with here.
|
|
|
|
|
|
|
|
|
|
The scheduler first traverses the data flow graph, starting with
|
|
|
|
|
the last instruction, and proceeding to the first, assigning values
|
|
|
|
|
to insn_priority as it goes. This sorts the instructions
|
|
|
|
|
topologically by data dependence.
|
|
|
|
|
|
|
|
|
|
Once priorities have been established, we order the insns using
|
|
|
|
|
list scheduling. This works as follows: starting with a list of
|
|
|
|
|
all the ready insns, and sorted according to priority number, we
|
|
|
|
|
schedule the insn from the end of the list by placing its
|
|
|
|
|
predecessors in the list according to their priority order. We
|
|
|
|
|
consider this insn scheduled by setting the pointer to the "end" of
|
|
|
|
|
the list to point to the previous insn. When an insn has no
|
|
|
|
|
predecessors, we either queue it until sufficient time has elapsed
|
|
|
|
|
or add it to the ready list. As the instructions are scheduled or
|
|
|
|
|
when stalls are introduced, the queue advances and dumps insns into
|
|
|
|
|
the ready list. When all insns down to the lowest priority have
|
|
|
|
|
been scheduled, the critical path of the basic block has been made
|
|
|
|
|
as short as possible. The remaining insns are then scheduled in
|
|
|
|
|
remaining slots.
|
|
|
|
|
|
|
|
|
|
Function unit conflicts are resolved during forward list scheduling
|
|
|
|
|
by tracking the time when each insn is committed to the schedule
|
|
|
|
|
and from that, the time the function units it uses must be free.
|
|
|
|
|
As insns on the ready list are considered for scheduling, those
|
|
|
|
|
that would result in a blockage of the already committed insns are
|
|
|
|
|
queued until no blockage will result.
|
|
|
|
|
|
|
|
|
|
The following list shows the order in which we want to break ties
|
|
|
|
|
among insns in the ready list:
|
|
|
|
|
|
|
|
|
|
1. choose insn with the longest path to end of bb, ties
|
|
|
|
|
broken by
|
|
|
|
|
2. choose insn with least contribution to register pressure,
|
|
|
|
|
ties broken by
|
|
|
|
|
3. prefer in-block upon interblock motion, ties broken by
|
|
|
|
|
4. prefer useful upon speculative motion, ties broken by
|
|
|
|
|
5. choose insn with largest control flow probability, ties
|
|
|
|
|
broken by
|
|
|
|
|
6. choose insn with the least dependences upon the previously
|
|
|
|
|
scheduled insn, or finally
|
1998-06-05 13:32:28 +02:00
|
|
|
|
7 choose the insn which has the most insns dependent on it.
|
|
|
|
|
8. choose insn with lowest UID.
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
|
|
|
|
Memory references complicate matters. Only if we can be certain
|
|
|
|
|
that memory references are not part of the data dependency graph
|
|
|
|
|
(via true, anti, or output dependence), can we move operations past
|
|
|
|
|
memory references. To first approximation, reads can be done
|
|
|
|
|
independently, while writes introduce dependencies. Better
|
|
|
|
|
approximations will yield fewer dependencies.
|
|
|
|
|
|
|
|
|
|
Before reload, an extended analysis of interblock data dependences
|
|
|
|
|
is required for interblock scheduling. This is performed in
|
|
|
|
|
compute_block_backward_dependences ().
|
|
|
|
|
|
|
|
|
|
Dependencies set up by memory references are treated in exactly the
|
|
|
|
|
same way as other dependencies, by using LOG_LINKS backward
|
|
|
|
|
dependences. LOG_LINKS are translated into INSN_DEPEND forward
|
|
|
|
|
dependences for the purpose of forward list scheduling.
|
|
|
|
|
|
|
|
|
|
Having optimized the critical path, we may have also unduly
|
|
|
|
|
extended the lifetimes of some registers. If an operation requires
|
|
|
|
|
that constants be loaded into registers, it is certainly desirable
|
|
|
|
|
to load those constants as early as necessary, but no earlier.
|
|
|
|
|
I.e., it will not do to load up a bunch of registers at the
|
|
|
|
|
beginning of a basic block only to use them at the end, if they
|
|
|
|
|
could be loaded later, since this may result in excessive register
|
|
|
|
|
utilization.
|
|
|
|
|
|
|
|
|
|
Note that since branches are never in basic blocks, but only end
|
|
|
|
|
basic blocks, this pass will not move branches. But that is ok,
|
|
|
|
|
since we can use GNU's delayed branch scheduling pass to take care
|
|
|
|
|
of this case.
|
|
|
|
|
|
|
|
|
|
Also note that no further optimizations based on algebraic
|
|
|
|
|
identities are performed, so this pass would be a good one to
|
|
|
|
|
perform instruction splitting, such as breaking up a multiply
|
|
|
|
|
instruction into shifts and adds where that is profitable.
|
|
|
|
|
|
|
|
|
|
Given the memory aliasing analysis that this pass should perform,
|
|
|
|
|
it should be possible to remove redundant stores to memory, and to
|
|
|
|
|
load values from registers instead of hitting memory.
|
|
|
|
|
|
|
|
|
|
Before reload, speculative insns are moved only if a 'proof' exists
|
|
|
|
|
that no exception will be caused by this, and if no live registers
|
|
|
|
|
exist that inhibit the motion (live registers constraints are not
|
|
|
|
|
represented by data dependence edges).
|
|
|
|
|
|
|
|
|
|
This pass must update information that subsequent passes expect to
|
|
|
|
|
be correct. Namely: reg_n_refs, reg_n_sets, reg_n_deaths,
|
basic-block.h (basic_block_head): Rename to x_basic_block_head.
* basic-block.h (basic_block_head): Rename to x_basic_block_head.
(basic_block_end): Rename to x_basic_block_end.
(BLOCK_HEAD, BLOCK_END): Update.
* caller-save.c: Change basic_block_head/end references to
BLOCK_HEAD/END.
* combine.c, flow.c, function.c, gcse.c, global.c: Likewise.
* graph.c, haifa-sched.c, local-alloc.c, regclass.c: Likewise.
* regmove.c, reload1.c, reorg.c, sched.c: Likewise.
From-SVN: r24622
1999-01-11 23:37:20 +01:00
|
|
|
|
reg_n_calls_crossed, and reg_live_length. Also, BLOCK_HEAD,
|
|
|
|
|
BLOCK_END.
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
|
|
|
|
The information in the line number notes is carefully retained by
|
|
|
|
|
this pass. Notes that refer to the starting and ending of
|
|
|
|
|
exception regions are also carefully retained by this pass. All
|
|
|
|
|
other NOTE insns are grouped in their same relative order at the
|
2000-12-03 20:00:00 +01:00
|
|
|
|
beginning of basic blocks and regions that have been scheduled. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
|
|
|
|
#include "config.h"
|
1998-02-17 22:35:43 +01:00
|
|
|
|
#include "system.h"
|
c-aux-info.c, [...]: Include toplev.h for real declaration of trim_filename.
1999-04-17 20:11 -0400 Zack Weinberg <zack@rabi.columbia.edu>
* c-aux-info.c, emit-rtl.c, explow.c, expmed.c, gcse.c,
haifa-sched.c, optabs.c, reorg.c, resource.c, sched.c: Include
toplev.h for real declaration of trim_filename.
* Makefile.in: Update dependencies.
From-SVN: r26523
1999-04-17 19:14:58 +02:00
|
|
|
|
#include "toplev.h"
|
1997-08-12 06:07:19 +02:00
|
|
|
|
#include "rtl.h"
|
1999-09-20 12:00:03 +02:00
|
|
|
|
#include "tm_p.h"
|
2000-05-20 00:27:28 +02:00
|
|
|
|
#include "hard-reg-set.h"
|
1997-08-12 06:07:19 +02:00
|
|
|
|
#include "basic-block.h"
|
|
|
|
|
#include "regs.h"
|
1999-08-09 16:00:21 +02:00
|
|
|
|
#include "function.h"
|
1997-08-12 06:07:19 +02:00
|
|
|
|
#include "flags.h"
|
|
|
|
|
#include "insn-config.h"
|
|
|
|
|
#include "insn-attr.h"
|
|
|
|
|
#include "except.h"
|
Warning Fixes:
* Makefile.in (print-rtl.o): Depend on bitmap.h.
(dbxout.o): Depend on toplev.h.
($(SCHED_PREFIX)sched.o): Likewise.
($(out_object_file)): Likewise for system.h and toplev.h.
(cppmain.o): Depend on gansidecl.h.
(cpplib.o): Likewise.
(cpperror.o): Likewise.
(cppexp.o): Likewise.
(cpphash.o): Likewise.
(cppalloc.o): Likewise.
(fix-header.o): Depend on cpplib.h and cpphash.h.
(scan-decls.o): Depend on gansidecl.h.
* basic-block.h (free_regset_vector): Add prototype.
* cccp.c (check_precompiled): Mark parameter `fname' with
ATTRIBUTE_UNUSED.
(do_assert): Likewise for `op' and `keyword'.
(do_unassert): Likewise.
(do_line): Likewise for `keyword'.
(do_error): Likewise for `op' and `keyword'.
(do_warning): Likewise.
(do_ident): Likewise for `keyword'.
(do_pragma): Likewise for `limit', `op' and `keyword'.
(do_sccs): Likewise.
(do_if): Likewise for `keyword'.
(do_elif): Likewise.
(do_else): Likewise.
(do_endif): Likewise.
* collect2.c (getenv): Remove redundant prototype.
(collect_exit, collect_execute, dump_file): Likewise.
(dump_list): Wrap prototype and definition in COLLECT_EXPORT_LIST.
(dump_prefix_list): Hide prototype and definition.
* sparc.c: Include toplev.h.
(intreg_operand): Mark parameter `mode' with ATTRIBUTE_UNUSED.
(symbolic_memory_operand): Likewise.
(sp64_medium_pic_operand): Likewise.
(data_segment_operand): Likewise.
(text_segment_operand): Likewise.
(splittable_symbolic_memory_operand): Likewise.
(splittable_immediate_memory_operand): Likewise.
(eq_or_neq): Likewise.
(normal_comp_operator): Likewise.
(noov_compare_op): Likewise.
(v9_regcmp_op): Likewise.
(v8plus_regcmp_op): Likewise.
(extend_op): Likewise.
(cc_arithop): Likewise.
(cc_arithopn): Likewise.
(small_int): Likewise.
(uns_small_int): Likewise.
(clobbered_register): Likewise.
(legitimize_pic_address): Likewise.
(delay_operand): Likewise.
(sparc_builtin_saveregs): Remove unused variable `stdarg'.
* sparc.h (order_regs_for_local_alloc, eligible_for_return_delay,
sparc_issue_rate, v8plus_regcmp_p): Add prototypes.
* sparc.md (cmpdi_v8plus): Add abort for default case in switch.
* cppalloc.c: Include gansidecl.h.
* cpperror.c: Include stdarg.h/varargs.h and gansidecl.h.
(cpp_file_line_for_message): Mark parameter `pfile' with
ATTRIBUTE_UNUSED.
(v_cpp_message): New function.
(cpp_message): Use it. Also convert to variable arguments.
(cpp_fatal): Likewise.
(cpp_pfatal_with_name): Constify parameter `name'.
* cppexp.c: Move gansidecl.h before cpplib.h.
* cpphash.c: Likewise.
* cpphash.h (hashf, delete_macro): Add prototypes.
* cpplib.c: Include stdarg.h/varargs.h and move gansidecl.h before
cpplib.h. Don't include errno.h.
(update_path): Add arguments to prototype.
(cpp_fatal, cpp_file_line_for_message, cpp_message, delete_macro,
cpp_print_containing_files): Remove redundant prototypes.
(cpp_hash_cleanup, add_import, append_include_chain,
make_assertion, path_include, initialize_builtins,
initialize_char_syntax, finclude, validate_else, comp_def_part,
lookup_import, redundant_include_p, is_system_include,
read_name_map, read_filename_string, open_include_file,
check_macro_name, compare_defs, compare_token_lists,
eval_if_expression, change_newlines): Add prototype arguments.
(hashf): Remove redundant prototype.
(read_token_list, free_token_list, safe_read, xcalloc, savestring,
conditional_skip, skip_if_group): Add prototype arguments.
(fdopen): Remove redundant prototype.
(do_define, do_line, do_include, do_undef, do_error, do_pragma,
do_ident, do_if, do_xifdef, do_else, do_elif, do_endif, do_sccs,
do_once, do_assert, do_unassert, do_warning): Add prototype arguments.
(struct directive): Add prototype arguments to function pointer
member `func'.
(handle_directive): Add missing arguments to call to `do_line'.
(do_include): Mark parameters `unused1' and `unused2' with
ATTRIBUTE_UNUSED.
(do_line): Likewise for `keyword' and new parameters `unused1' and
`unused2'.
(do_error): Likewise for `keyword'.
(do_warning): Likewise. Also add missing argument `pfile' in call
to cpp_pedwarn.
(do_once): Mark parameter `keyword', `unused1' and `unused2' with
ATTRIBUTE_UNUSED.
(do_ident): Likewise for `keyword', `buf' and `limit'.
(do_pragma): Likewise. Also add missing arguments in call to do_once.
(do_sccs): Mark parameter `keyword', `buf' and `limit' with
ATTRIBUTE_UNUSED.
(do_if): Likewise for `keyword'.
(do_elif): Likewise.
(eval_if_expression): Likewise for `buf' and `length'.
(do_xifdef): Likewise for `unused1' and `unused2'.
(do_else): Likewise for `keyword', `buf' and `limit'.
(do_endif): Likewise.
(parse_name): Add missing argument `pfile' in call to cpp_pedwarn.
(cpp_handle_options): Remove superfluous NULL argument in call to
cpp_fatal.
(cpp_handle_options): Likewise.
(do_assert): Mark parameter `keyword', `buf' and `limit' with
ATTRIBUTE_UNUSED.
(do_unassert): Likewise.
(cpp_print_file_and_line): Add missing argument `pfile' in call to
cpp_file_line_for_message.
(v_cpp_error): New function.
(cpp_error): Use it. Also accept variable arguments.
(v_cpp_warning): New function.
(cpp_warning): Use it. Also accept variable arguments.
(cpp_pedwarn): Accept variable arguments.
(v_cpp_error_with_line): New function
(cpp_error_with_line): Use it. Accept variable arguments.
(v_cpp_warning_with_line): New function.
(cpp_warning_with_line): Use it. Accept variable arguments. Hide
definition.
(cpp_pedwarn_with_line): Accept variable arguments.
(cpp_pedwarn_with_file_and_line): Likewise.
(cpp_error_from_errno): Constify parameter `name'. Add missing
argument `pfile' in call to cpp_file_line_for_message.
(cpp_perror_with_name): Constify parameter `name'.
* cpplib.h: Define PARAMS() in terms of PROTO().
(fatal): Remove redundant prototype.
(cpp_error, cpp_warning, cpp_pedwarn, cpp_error_with_line,
cpp_pedwarn_with_line, cpp_pedwarn_with_file_and_line,
cpp_error_from_errno, cpp_perror_with_name, cpp_pfatal_with_name,
cpp_fatal, cpp_message, cpp_pfatal_with_name,
cpp_file_line_for_message, cpp_print_containing_files): Add
arguments to prototypes.
(scan_decls, cpp_finish): Add prototypes.
* cppmain.c: Include gansidecl.h.
(main): Remove unused variable `i'.
* dbxout.c: Include toplev.h.
* demangle.h (do_tlink, collect_execute, collect_exit,
collect_wait, dump_file, file_exists): Add prototype.
* dwarf2out.c (dwarf_type_encoding_name, decl_start_label): Hide
prototype and definition.
(gen_unspecified_parameters_die): Don't assign results of call to
function new_die() to unused variable `parm_die'.
(dwarf2out_line): Mark parameter `filename' with ATTRIBUTE_UNUSED.
(dwarf2out_define): Likewise for `lineno' and `buffer'.
* dwarfout.c (output_unsigned_leb128, output_signed_leb128): Hide
prototype and definition.
(output_die): Add prototype arguments to function pointer arg.
(output_unspecified_parameters_die): Mark parameter `arg' with
ATTRIBUTE_UNUSED.
* except.c (output_exception_table_entry): Remove unused variable
`eh_entry'.
* except.h (expand_fixup_region_start, expand_fixup_region_end):
Add prototypes.
* expr.c (do_jump_by_parts_equality_rtx): Remove prototype.
* expr.h (do_jump_by_parts_equality_rtx): Add prototype.
* fix-header.c: Include stdarg.h/varargs.h, move gansidecl.h
before cpplib.h, include cpphash.h, remove redundant prototype of
cpp_fatal, don't define `const', add a prototype for `fatal'.
(cpp_file_line_for_message): Add missing arguments `pfile'.
(v_cpp_message): New function.
(cpp_message): Use it.
(v_fatal): New function.
(fatal, cpp_fatal): Use it.
(cpp_pfatal_with_name): Constify parameter `name'.
* flow.c (free_regset_vector): Remove redundant prototype.
* function.c (round_down): Wrap prototype and definition with
macro ARGS_GROW_DOWNWARD.
(record_insns): Wrap prototype and definition with
defined (HAVE_prologue) || defined (HAVE_epilogue).
* gansidecl.h (ATTRIBUTE_PRINTF_4, ATTRIBUTE_PRINTF_5): New macros.
* gen-protos.c: Include gansidecl.h.
(hashf): Don't make it static, constify parameter `name'.
* genattrtab.c (check_attr_test): Change XEXP() to XSTR() to match
specifier %s in calls to function `fatal'.
* haifa-sched.c: Include toplev.h.
(find_rgns): Remove unused variable `j'.
* integrate.c (note_modified_parmregs): Mark parameter `x' with
ATTRIBUTE_UNUSED.
(mark_stores): Likewise.
* jump.c (mark_modified_reg): Likewise.
* output.h (insn_current_reference_address): Add prototype.
(eh_frame_section): Likewise.
* print-rtl.c: Include bitmap.h.
* reload1.c (reload): Wrap variables `note' and `next' in macro
PRESERVE_DEATH_INFO_REGNO_P.
(forget_old_reloads_1): Mark parameter `ignored' with
ATTRIBUTE_UNUSED.
(choose_reload_regs): Remove unused variable `in'.
(reload_cse_invalidate_mem): Mark parameter `ignore' with
ATTRIBUTE_UNUSED.
(reload_cse_check_clobber): Likewise.
* rtl.h (expand_null_return, reg_classes_intersect_p): Add prototype.
(mark_elimination): Fix typo in prototype.
* scan-decls.c: Include gansidecl.h.
* tree.h (using_eh_for_cleanups, supports_one_only): Add prototype.
From-SVN: r19867
1998-05-19 10:42:48 +02:00
|
|
|
|
#include "toplev.h"
|
1998-10-17 22:26:29 +02:00
|
|
|
|
#include "recog.h"
|
2000-12-03 13:53:49 +01:00
|
|
|
|
#include "sched-int.h"
|
haifa-sched.c: Convert to target hooks.
* 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.
From-SVN: r45009
2001-08-18 22:25:54 +02:00
|
|
|
|
#include "target.h"
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
|
|
|
|
#ifdef INSN_SCHEDULING
|
|
|
|
|
|
|
|
|
|
/* issue_rate is the number of insns that can be scheduled in the same
|
|
|
|
|
machine cycle. It can be defined in the config/mach/mach.h file,
|
|
|
|
|
otherwise we set it to 1. */
|
|
|
|
|
|
|
|
|
|
static int issue_rate;
|
|
|
|
|
|
2002-04-30 00:34:36 +02:00
|
|
|
|
/* If the following variable value is non zero, the scheduler inserts
|
|
|
|
|
bubbles (nop insns). The value of variable affects on scheduler
|
|
|
|
|
behavior only if automaton pipeline interface with multipass
|
|
|
|
|
scheduling is used and hook dfa_bubble is defined. */
|
|
|
|
|
int insert_schedule_bubbles_p = 0;
|
|
|
|
|
|
1998-05-06 18:32:40 +02:00
|
|
|
|
/* sched-verbose controls the amount of debugging output the
|
2000-04-16 00:27:59 +02:00
|
|
|
|
scheduler prints. It is controlled by -fsched-verbose=N:
|
1997-08-12 06:07:19 +02:00
|
|
|
|
N>0 and no -DSR : the output is directed to stderr.
|
|
|
|
|
N>=10 will direct the printouts to stderr (regardless of -dSR).
|
|
|
|
|
N=1: same as -dSR.
|
|
|
|
|
N=2: bb's probabilities, detailed ready list info, unit/insn info.
|
|
|
|
|
N=3: rtl at abort point, control-flow, regions info.
|
1998-05-06 18:32:40 +02:00
|
|
|
|
N=5: dependences info. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
|
|
|
|
static int sched_verbose_param = 0;
|
2000-12-03 20:00:00 +01:00
|
|
|
|
int sched_verbose = 0;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
1999-09-06 23:55:23 +02:00
|
|
|
|
/* Debugging file. All printouts are sent to dump, which is always set,
|
1997-08-12 06:07:19 +02:00
|
|
|
|
either to stderr, or to the dump listing file (-dRS). */
|
2000-12-03 15:35:17 +01:00
|
|
|
|
FILE *sched_dump = 0;
|
2000-12-02 11:47:42 +01:00
|
|
|
|
|
|
|
|
|
/* Highest uid before scheduling. */
|
|
|
|
|
static int old_max_uid;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
|
|
|
|
/* fix_sched_param() is called from toplev.c upon detection
|
2000-04-16 00:27:59 +02:00
|
|
|
|
of the -fsched-verbose=N option. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
fix_sched_param (param, val)
|
rtl.c (rtx_name): Constify a char*.
* rtl.c (rtx_name): Constify a char*.
* rtl.h (rtx_name, fix_sched_param): Likewise.
* gmicro/gmicro.c (rtx_name): Remove redundant declaration.
(mypr): Use accessor macro, not `rtx_name'.
* genemit.c (print_code): Constify a char*.
* genopinit.c (gen_insn): Use accessor macro, not `rtx_name'.
* genpeep.c (print_code): Constify a char*.
* genrecog.c (print_code): Likewise.
* graph.c (start_fct, start_bb, node_data, draw_edge, end_fct,
end_bb): Add static prototype.
(draw_edge): Constify a char*.
(end_bb): Remove unused parameter.
* haifa-sched.c (fix_sched_param, safe_concat, print_exp
print_block_visualization): Constify a char*.
From-SVN: r28782
1999-08-21 00:32:54 +02:00
|
|
|
|
const char *param, *val;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
{
|
1998-05-06 18:32:40 +02:00
|
|
|
|
if (!strcmp (param, "verbose"))
|
1997-08-12 06:07:19 +02:00
|
|
|
|
sched_verbose_param = atoi (val);
|
|
|
|
|
else
|
|
|
|
|
warning ("fix_sched_param: unknown param: %s", param);
|
|
|
|
|
}
|
|
|
|
|
|
2000-12-03 17:11:45 +01:00
|
|
|
|
struct haifa_insn_data *h_i_d;
|
haifa-sched.c (struct haifa_insn_data, h_i_d): New.
* haifa-sched.c (struct haifa_insn_data, h_i_d): New.
(insn_luid, insn_priority, insn_costs, insn_units): Remove.
(insn_reg_weight, insn_depend, insn_dep_count): Remove.
(insn_blockage, insn_ref_count, line_note, insn_tick): Remove.
(cant_move, fed_by_spec_load, is_load_insn): Remove.
(schedule_region): Remove unused variable.
(schedule_insns): Allocate h_i_d, and not all the separate arrays.
From-SVN: r30435
1999-11-06 20:41:37 +01:00
|
|
|
|
|
1997-08-12 06:07:19 +02:00
|
|
|
|
#define DONE_PRIORITY -1
|
|
|
|
|
#define MAX_PRIORITY 0x7fffffff
|
|
|
|
|
#define TAIL_PRIORITY 0x7ffffffe
|
|
|
|
|
#define LAUNCH_PRIORITY 0x7f000001
|
|
|
|
|
#define DONE_PRIORITY_P(INSN) (INSN_PRIORITY (INSN) < 0)
|
|
|
|
|
#define LOW_PRIORITY_P(INSN) ((INSN_PRIORITY (INSN) & 0x7f000000) == 0)
|
|
|
|
|
|
haifa-sched.c (struct haifa_insn_data, h_i_d): New.
* haifa-sched.c (struct haifa_insn_data, h_i_d): New.
(insn_luid, insn_priority, insn_costs, insn_units): Remove.
(insn_reg_weight, insn_depend, insn_dep_count): Remove.
(insn_blockage, insn_ref_count, line_note, insn_tick): Remove.
(cant_move, fed_by_spec_load, is_load_insn): Remove.
(schedule_region): Remove unused variable.
(schedule_insns): Allocate h_i_d, and not all the separate arrays.
From-SVN: r30435
1999-11-06 20:41:37 +01:00
|
|
|
|
#define LINE_NOTE(INSN) (h_i_d[INSN_UID (INSN)].line_note)
|
|
|
|
|
#define INSN_TICK(INSN) (h_i_d[INSN_UID (INSN)].tick)
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
|
|
|
|
/* Vector indexed by basic block number giving the starting line-number
|
|
|
|
|
for each basic block. */
|
|
|
|
|
static rtx *line_note_head;
|
|
|
|
|
|
|
|
|
|
/* List of important notes we must keep around. This is a pointer to the
|
|
|
|
|
last element in the list. */
|
|
|
|
|
static rtx note_list;
|
|
|
|
|
|
|
|
|
|
/* Queues, etc. */
|
|
|
|
|
|
|
|
|
|
/* An instruction is ready to be scheduled when all insns preceding it
|
|
|
|
|
have already been scheduled. It is important to ensure that all
|
|
|
|
|
insns which use its result will not be executed until its result
|
|
|
|
|
has been computed. An insn is maintained in one of four structures:
|
|
|
|
|
|
|
|
|
|
(P) the "Pending" set of insns which cannot be scheduled until
|
|
|
|
|
their dependencies have been satisfied.
|
|
|
|
|
(Q) the "Queued" set of insns that can be scheduled when sufficient
|
|
|
|
|
time has passed.
|
|
|
|
|
(R) the "Ready" list of unscheduled, uncommitted insns.
|
|
|
|
|
(S) the "Scheduled" list of insns.
|
|
|
|
|
|
|
|
|
|
Initially, all insns are either "Pending" or "Ready" depending on
|
|
|
|
|
whether their dependencies are satisfied.
|
|
|
|
|
|
|
|
|
|
Insns move from the "Ready" list to the "Scheduled" list as they
|
|
|
|
|
are committed to the schedule. As this occurs, the insns in the
|
|
|
|
|
"Pending" list have their dependencies satisfied and move to either
|
|
|
|
|
the "Ready" list or the "Queued" set depending on whether
|
|
|
|
|
sufficient time has passed to make them ready. As time passes,
|
|
|
|
|
insns move from the "Queued" set to the "Ready" list. Insns may
|
|
|
|
|
move from the "Ready" list to the "Queued" set if they are blocked
|
|
|
|
|
due to a function unit conflict.
|
|
|
|
|
|
|
|
|
|
The "Pending" list (P) are the insns in the INSN_DEPEND of the unscheduled
|
|
|
|
|
insns, i.e., those that are ready, queued, and pending.
|
|
|
|
|
The "Queued" set (Q) is implemented by the variable `insn_queue'.
|
|
|
|
|
The "Ready" list (R) is implemented by the variables `ready' and
|
|
|
|
|
`n_ready'.
|
|
|
|
|
The "Scheduled" list (S) is the new insn chain built by this pass.
|
|
|
|
|
|
|
|
|
|
The transition (R->S) is implemented in the scheduling loop in
|
|
|
|
|
`schedule_block' when the best insn to schedule is chosen.
|
|
|
|
|
The transition (R->Q) is implemented in `queue_insn' when an
|
1998-05-06 23:09:07 +02:00
|
|
|
|
insn is found to have a function unit conflict with the already
|
1997-08-12 06:07:19 +02:00
|
|
|
|
committed insns.
|
|
|
|
|
The transitions (P->R and P->Q) are implemented in `schedule_insn' as
|
|
|
|
|
insns move from the ready list to the scheduled list.
|
|
|
|
|
The transition (Q->R) is implemented in 'queue_to_insn' as time
|
|
|
|
|
passes or stalls are introduced. */
|
|
|
|
|
|
|
|
|
|
/* Implement a circular buffer to delay instructions until sufficient
|
2002-04-30 00:34:36 +02:00
|
|
|
|
time has passed. For the old pipeline description interface,
|
|
|
|
|
INSN_QUEUE_SIZE is a power of two larger than MAX_BLOCKAGE and
|
|
|
|
|
MAX_READY_COST computed by genattr.c. For the new pipeline
|
|
|
|
|
description interface, MAX_INSN_QUEUE_INDEX is a power of two minus
|
|
|
|
|
one which is larger than maximal time of instruction execution
|
|
|
|
|
computed by genattr.c on the base maximal time of functional unit
|
|
|
|
|
reservations and geting a result. This is the longest time an
|
|
|
|
|
insn may be queued. */
|
|
|
|
|
|
|
|
|
|
#define MAX_INSN_QUEUE_INDEX max_insn_queue_index_macro_value
|
|
|
|
|
|
|
|
|
|
static rtx *insn_queue;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
static int q_ptr = 0;
|
|
|
|
|
static int q_size = 0;
|
2002-04-30 00:34:36 +02:00
|
|
|
|
#define NEXT_Q(X) (((X)+1) & MAX_INSN_QUEUE_INDEX)
|
|
|
|
|
#define NEXT_Q_AFTER(X, C) (((X)+C) & MAX_INSN_QUEUE_INDEX)
|
|
|
|
|
|
|
|
|
|
/* The following variable defines value for macro
|
|
|
|
|
MAX_INSN_QUEUE_INDEX. */
|
|
|
|
|
static int max_insn_queue_index_macro_value;
|
|
|
|
|
|
|
|
|
|
/* The following variable value refers for all current and future
|
|
|
|
|
reservations of the processor units. */
|
|
|
|
|
state_t curr_state;
|
|
|
|
|
|
|
|
|
|
/* The following variable value is size of memory representing all
|
|
|
|
|
current and future reservations of the processor units. It is used
|
|
|
|
|
only by DFA based scheduler. */
|
|
|
|
|
static size_t dfa_state_size;
|
|
|
|
|
|
|
|
|
|
/* The following array is used to find the best insn from ready when
|
|
|
|
|
the automaton pipeline interface is used. */
|
|
|
|
|
static char *ready_try;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-11-24 18:36:47 +01:00
|
|
|
|
/* Describe the ready list of the scheduler.
|
|
|
|
|
VEC holds space enough for all insns in the current region. VECLEN
|
|
|
|
|
says how many exactly.
|
|
|
|
|
FIRST is the index of the element with the highest priority; i.e. the
|
|
|
|
|
last one in the ready list, since elements are ordered by ascending
|
|
|
|
|
priority.
|
|
|
|
|
N_READY determines how many insns are on the ready list. */
|
|
|
|
|
|
|
|
|
|
struct ready_list
|
|
|
|
|
{
|
|
|
|
|
rtx *vec;
|
|
|
|
|
int veclen;
|
|
|
|
|
int first;
|
|
|
|
|
int n_ready;
|
|
|
|
|
};
|
|
|
|
|
|
1997-08-12 06:07:19 +02:00
|
|
|
|
/* Forward declarations. */
|
2002-04-30 00:34:36 +02:00
|
|
|
|
|
|
|
|
|
/* The scheduler using only DFA description should never use the
|
|
|
|
|
following five functions: */
|
2000-01-17 16:28:05 +01:00
|
|
|
|
static unsigned int blockage_range PARAMS ((int, rtx));
|
|
|
|
|
static void clear_units PARAMS ((void));
|
|
|
|
|
static void schedule_unit PARAMS ((int, rtx, int));
|
|
|
|
|
static int actual_hazard PARAMS ((int, rtx, int, int));
|
|
|
|
|
static int potential_hazard PARAMS ((int, rtx, int));
|
2002-04-30 00:34:36 +02:00
|
|
|
|
|
2000-01-17 16:28:05 +01:00
|
|
|
|
static int priority PARAMS ((rtx));
|
|
|
|
|
static int rank_for_schedule PARAMS ((const PTR, const PTR));
|
|
|
|
|
static void swap_sort PARAMS ((rtx *, int));
|
|
|
|
|
static void queue_insn PARAMS ((rtx, int));
|
2000-11-24 18:36:47 +01:00
|
|
|
|
static void schedule_insn PARAMS ((rtx, struct ready_list *, int));
|
2000-01-17 16:28:05 +01:00
|
|
|
|
static void find_insn_reg_weight PARAMS ((int));
|
|
|
|
|
static void adjust_priority PARAMS ((rtx));
|
2002-04-30 00:34:36 +02:00
|
|
|
|
static void advance_one_cycle PARAMS ((void));
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
|
|
|
|
/* Notes handling mechanism:
|
|
|
|
|
=========================
|
|
|
|
|
Generally, NOTES are saved before scheduling and restored after scheduling.
|
|
|
|
|
The scheduler distinguishes between three types of notes:
|
|
|
|
|
|
|
|
|
|
(1) LINE_NUMBER notes, generated and used for debugging. Here,
|
|
|
|
|
before scheduling a region, a pointer to the LINE_NUMBER note is
|
|
|
|
|
added to the insn following it (in save_line_notes()), and the note
|
|
|
|
|
is removed (in rm_line_notes() and unlink_line_notes()). After
|
|
|
|
|
scheduling the region, this pointer is used for regeneration of
|
|
|
|
|
the LINE_NUMBER note (in restore_line_notes()).
|
|
|
|
|
|
|
|
|
|
(2) LOOP_BEGIN, LOOP_END, SETJMP, EHREGION_BEG, EHREGION_END notes:
|
|
|
|
|
Before scheduling a region, a pointer to the note is added to the insn
|
|
|
|
|
that follows or precedes it. (This happens as part of the data dependence
|
|
|
|
|
computation). After scheduling an insn, the pointer contained in it is
|
|
|
|
|
used for regenerating the corresponding note (in reemit_notes).
|
|
|
|
|
|
|
|
|
|
(3) All other notes (e.g. INSN_DELETED): Before scheduling a block,
|
|
|
|
|
these notes are put in a list (in rm_other_notes() and
|
|
|
|
|
unlink_other_notes ()). After scheduling the block, these notes are
|
|
|
|
|
inserted at the beginning of the block (in schedule_block()). */
|
|
|
|
|
|
2000-01-17 16:28:05 +01:00
|
|
|
|
static rtx unlink_other_notes PARAMS ((rtx, rtx));
|
|
|
|
|
static rtx unlink_line_notes PARAMS ((rtx, rtx));
|
|
|
|
|
static rtx reemit_notes PARAMS ((rtx, rtx));
|
|
|
|
|
|
2000-11-24 18:36:47 +01:00
|
|
|
|
static rtx *ready_lastpos PARAMS ((struct ready_list *));
|
|
|
|
|
static void ready_sort PARAMS ((struct ready_list *));
|
|
|
|
|
static rtx ready_remove_first PARAMS ((struct ready_list *));
|
2000-01-17 16:28:05 +01:00
|
|
|
|
|
2000-11-24 18:36:47 +01:00
|
|
|
|
static void queue_to_ready PARAMS ((struct ready_list *));
|
|
|
|
|
|
|
|
|
|
static void debug_ready_list PARAMS ((struct ready_list *));
|
2000-01-17 16:28:05 +01:00
|
|
|
|
|
|
|
|
|
static rtx move_insn1 PARAMS ((rtx, rtx));
|
|
|
|
|
static rtx move_insn PARAMS ((rtx, rtx));
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2002-04-30 00:34:36 +02:00
|
|
|
|
/* The following functions are used to implement multi-pass scheduling
|
|
|
|
|
on the first cycle. It is used only for DFA based scheduler. */
|
|
|
|
|
static rtx ready_element PARAMS ((struct ready_list *, int));
|
|
|
|
|
static rtx ready_remove PARAMS ((struct ready_list *, int));
|
|
|
|
|
static int max_issue PARAMS ((struct ready_list *, state_t, int *));
|
|
|
|
|
|
|
|
|
|
static rtx choose_ready PARAMS ((struct ready_list *));
|
|
|
|
|
|
1997-08-12 06:07:19 +02:00
|
|
|
|
#endif /* INSN_SCHEDULING */
|
|
|
|
|
|
2000-12-03 13:53:49 +01:00
|
|
|
|
/* Point to state used for the current scheduling pass. */
|
|
|
|
|
struct sched_info *current_sched_info;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
|
|
|
|
#ifndef INSN_SCHEDULING
|
|
|
|
|
void
|
|
|
|
|
schedule_insns (dump_file)
|
2000-01-11 00:48:03 +01:00
|
|
|
|
FILE *dump_file ATTRIBUTE_UNUSED;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
#else
|
1998-05-12 14:20:18 +02:00
|
|
|
|
|
1997-08-12 06:07:19 +02:00
|
|
|
|
/* Pointer to the last instruction scheduled. Used by rank_for_schedule,
|
|
|
|
|
so that insns independent of the last scheduled insn will be preferred
|
|
|
|
|
over dependent instructions. */
|
|
|
|
|
|
|
|
|
|
static rtx last_scheduled_insn;
|
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
/* Compute the function units used by INSN. This caches the value
|
|
|
|
|
returned by function_units_used. A function unit is encoded as the
|
|
|
|
|
unit number if the value is non-negative and the compliment of a
|
|
|
|
|
mask if the value is negative. A function unit index is the
|
2002-04-30 00:34:36 +02:00
|
|
|
|
non-negative encoding. The scheduler using only DFA description
|
|
|
|
|
should never use the following function. */
|
1998-03-08 03:15:26 +01:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
HAIFA_INLINE int
|
|
|
|
|
insn_unit (insn)
|
|
|
|
|
rtx insn;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
int unit = INSN_UNIT (insn);
|
1998-03-08 03:15:26 +01:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
if (unit == 0)
|
1999-11-15 09:12:29 +01:00
|
|
|
|
{
|
2000-12-03 20:00:00 +01:00
|
|
|
|
recog_memoized (insn);
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
/* A USE insn, or something else we don't need to understand.
|
|
|
|
|
We can't pass these directly to function_units_used because it will
|
|
|
|
|
trigger a fatal error for unrecognizable insns. */
|
|
|
|
|
if (INSN_CODE (insn) < 0)
|
|
|
|
|
unit = -1;
|
|
|
|
|
else
|
1997-08-12 06:07:19 +02:00
|
|
|
|
{
|
2000-12-03 20:00:00 +01:00
|
|
|
|
unit = function_units_used (insn);
|
|
|
|
|
/* Increment non-negative values so we can cache zero. */
|
|
|
|
|
if (unit >= 0)
|
|
|
|
|
unit++;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
}
|
2000-12-03 20:00:00 +01:00
|
|
|
|
/* We only cache 16 bits of the result, so if the value is out of
|
|
|
|
|
range, don't cache it. */
|
|
|
|
|
if (FUNCTION_UNITS_SIZE < HOST_BITS_PER_SHORT
|
|
|
|
|
|| unit >= 0
|
|
|
|
|
|| (unit & ~((1 << (HOST_BITS_PER_SHORT - 1)) - 1)) == 0)
|
|
|
|
|
INSN_UNIT (insn) = unit;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
}
|
2000-12-03 20:00:00 +01:00
|
|
|
|
return (unit > 0 ? unit - 1 : unit);
|
|
|
|
|
}
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
/* Compute the blockage range for executing INSN on UNIT. This caches
|
|
|
|
|
the value returned by the blockage_range_function for the unit.
|
|
|
|
|
These values are encoded in an int where the upper half gives the
|
2002-04-30 00:34:36 +02:00
|
|
|
|
minimum value and the lower half gives the maximum value. The
|
|
|
|
|
scheduler using only DFA description should never use the following
|
|
|
|
|
function. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
HAIFA_INLINE static unsigned int
|
|
|
|
|
blockage_range (unit, insn)
|
|
|
|
|
int unit;
|
|
|
|
|
rtx insn;
|
|
|
|
|
{
|
|
|
|
|
unsigned int blockage = INSN_BLOCKAGE (insn);
|
|
|
|
|
unsigned int range;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
if ((int) UNIT_BLOCKED (blockage) != unit + 1)
|
1997-08-12 06:07:19 +02:00
|
|
|
|
{
|
2000-12-03 20:00:00 +01:00
|
|
|
|
range = function_units[unit].blockage_range_function (insn);
|
|
|
|
|
/* We only cache the blockage range for one unit and then only if
|
|
|
|
|
the values fit. */
|
|
|
|
|
if (HOST_BITS_PER_INT >= UNIT_BITS + 2 * BLOCKAGE_BITS)
|
|
|
|
|
INSN_BLOCKAGE (insn) = ENCODE_BLOCKAGE (unit + 1, range);
|
1997-08-12 06:07:19 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
2000-12-03 20:00:00 +01:00
|
|
|
|
range = BLOCKAGE_RANGE (blockage);
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
return range;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
}
|
|
|
|
|
|
2002-04-30 00:34:36 +02:00
|
|
|
|
/* A vector indexed by function unit instance giving the last insn to
|
|
|
|
|
use the unit. The value of the function unit instance index for
|
|
|
|
|
unit U instance I is (U + I * FUNCTION_UNITS_SIZE). The scheduler
|
|
|
|
|
using only DFA description should never use the following variable. */
|
|
|
|
|
#if FUNCTION_UNITS_SIZE
|
2000-12-03 20:00:00 +01:00
|
|
|
|
static rtx unit_last_insn[FUNCTION_UNITS_SIZE * MAX_MULTIPLICITY];
|
2002-04-30 00:34:36 +02:00
|
|
|
|
#else
|
|
|
|
|
static rtx unit_last_insn[1];
|
|
|
|
|
#endif
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2002-04-30 00:34:36 +02:00
|
|
|
|
/* A vector indexed by function unit instance giving the minimum time
|
|
|
|
|
when the unit will unblock based on the maximum blockage cost. The
|
|
|
|
|
scheduler using only DFA description should never use the following
|
|
|
|
|
variable. */
|
|
|
|
|
#if FUNCTION_UNITS_SIZE
|
2000-12-03 20:00:00 +01:00
|
|
|
|
static int unit_tick[FUNCTION_UNITS_SIZE * MAX_MULTIPLICITY];
|
2002-04-30 00:34:36 +02:00
|
|
|
|
#else
|
|
|
|
|
static int unit_tick[1];
|
|
|
|
|
#endif
|
2000-12-03 20:00:00 +01:00
|
|
|
|
|
|
|
|
|
/* A vector indexed by function unit number giving the number of insns
|
2002-04-30 00:34:36 +02:00
|
|
|
|
that remain to use the unit. The scheduler using only DFA
|
|
|
|
|
description should never use the following variable. */
|
|
|
|
|
#if FUNCTION_UNITS_SIZE
|
2000-12-03 20:00:00 +01:00
|
|
|
|
static int unit_n_insns[FUNCTION_UNITS_SIZE];
|
2002-04-30 00:34:36 +02:00
|
|
|
|
#else
|
|
|
|
|
static int unit_n_insns[1];
|
|
|
|
|
#endif
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2002-04-30 00:34:36 +02:00
|
|
|
|
/* Access the unit_last_insn array. Used by the visualization code.
|
|
|
|
|
The scheduler using only DFA description should never use the
|
|
|
|
|
following function. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
rtx
|
|
|
|
|
get_unit_last_insn (instance)
|
|
|
|
|
int instance;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
{
|
2000-12-03 20:00:00 +01:00
|
|
|
|
return unit_last_insn[instance];
|
1997-08-12 06:07:19 +02:00
|
|
|
|
}
|
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
/* Reset the function unit state to the null state. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
|
|
|
|
static void
|
2000-12-03 20:00:00 +01:00
|
|
|
|
clear_units ()
|
1997-08-12 06:07:19 +02:00
|
|
|
|
{
|
2000-12-03 20:00:00 +01:00
|
|
|
|
memset ((char *) unit_last_insn, 0, sizeof (unit_last_insn));
|
|
|
|
|
memset ((char *) unit_tick, 0, sizeof (unit_tick));
|
|
|
|
|
memset ((char *) unit_n_insns, 0, sizeof (unit_n_insns));
|
|
|
|
|
}
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2002-04-30 00:34:36 +02:00
|
|
|
|
/* Return the issue-delay of an insn. The scheduler using only DFA
|
|
|
|
|
description should never use the following function. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
HAIFA_INLINE int
|
|
|
|
|
insn_issue_delay (insn)
|
|
|
|
|
rtx insn;
|
|
|
|
|
{
|
|
|
|
|
int i, delay = 0;
|
|
|
|
|
int unit = insn_unit (insn);
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
/* Efficiency note: in fact, we are working 'hard' to compute a
|
|
|
|
|
value that was available in md file, and is not available in
|
|
|
|
|
function_units[] structure. It would be nice to have this
|
|
|
|
|
value there, too. */
|
|
|
|
|
if (unit >= 0)
|
1997-08-12 06:07:19 +02:00
|
|
|
|
{
|
2000-12-03 20:00:00 +01:00
|
|
|
|
if (function_units[unit].blockage_range_function &&
|
|
|
|
|
function_units[unit].blockage_function)
|
|
|
|
|
delay = function_units[unit].blockage_function (insn, insn);
|
1997-08-12 06:07:19 +02:00
|
|
|
|
}
|
2000-12-03 20:00:00 +01:00
|
|
|
|
else
|
|
|
|
|
for (i = 0, unit = ~unit; unit; i++, unit >>= 1)
|
|
|
|
|
if ((unit & 1) != 0 && function_units[i].blockage_range_function
|
|
|
|
|
&& function_units[i].blockage_function)
|
|
|
|
|
delay = MAX (delay, function_units[i].blockage_function (insn, insn));
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
return delay;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
}
|
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
/* Return the actual hazard cost of executing INSN on the unit UNIT,
|
|
|
|
|
instance INSTANCE at time CLOCK if the previous actual hazard cost
|
2002-04-30 00:34:36 +02:00
|
|
|
|
was COST. The scheduler using only DFA description should never
|
|
|
|
|
use the following function. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
HAIFA_INLINE int
|
|
|
|
|
actual_hazard_this_instance (unit, instance, insn, clock, cost)
|
|
|
|
|
int unit, instance, clock, cost;
|
|
|
|
|
rtx insn;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
{
|
2000-12-03 20:00:00 +01:00
|
|
|
|
int tick = unit_tick[instance]; /* Issue time of the last issued insn. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
if (tick - clock > cost)
|
1997-08-12 06:07:19 +02:00
|
|
|
|
{
|
2000-12-03 20:00:00 +01:00
|
|
|
|
/* The scheduler is operating forward, so unit's last insn is the
|
|
|
|
|
executing insn and INSN is the candidate insn. We want a
|
|
|
|
|
more exact measure of the blockage if we execute INSN at CLOCK
|
|
|
|
|
given when we committed the execution of the unit's last insn.
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
The blockage value is given by either the unit's max blockage
|
|
|
|
|
constant, blockage range function, or blockage function. Use
|
|
|
|
|
the most exact form for the given unit. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
if (function_units[unit].blockage_range_function)
|
|
|
|
|
{
|
|
|
|
|
if (function_units[unit].blockage_function)
|
|
|
|
|
tick += (function_units[unit].blockage_function
|
|
|
|
|
(unit_last_insn[instance], insn)
|
|
|
|
|
- function_units[unit].max_blockage);
|
|
|
|
|
else
|
|
|
|
|
tick += ((int) MAX_BLOCKAGE_COST (blockage_range (unit, insn))
|
|
|
|
|
- function_units[unit].max_blockage);
|
1997-08-12 06:07:19 +02:00
|
|
|
|
}
|
2000-12-03 20:00:00 +01:00
|
|
|
|
if (tick - clock > cost)
|
|
|
|
|
cost = tick - clock;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
}
|
2000-12-03 20:00:00 +01:00
|
|
|
|
return cost;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
}
|
|
|
|
|
|
2002-04-30 00:34:36 +02:00
|
|
|
|
/* Record INSN as having begun execution on the units encoded by UNIT
|
|
|
|
|
at time CLOCK. The scheduler using only DFA description should
|
|
|
|
|
never use the following function. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
1998-05-12 14:20:18 +02:00
|
|
|
|
HAIFA_INLINE static void
|
1997-08-12 06:07:19 +02:00
|
|
|
|
schedule_unit (unit, insn, clock)
|
|
|
|
|
int unit, clock;
|
|
|
|
|
rtx insn;
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
if (unit >= 0)
|
|
|
|
|
{
|
|
|
|
|
int instance = unit;
|
|
|
|
|
#if MAX_MULTIPLICITY > 1
|
|
|
|
|
/* Find the first free instance of the function unit and use that
|
|
|
|
|
one. We assume that one is free. */
|
|
|
|
|
for (i = function_units[unit].multiplicity - 1; i > 0; i--)
|
|
|
|
|
{
|
|
|
|
|
if (!actual_hazard_this_instance (unit, instance, insn, clock, 0))
|
|
|
|
|
break;
|
|
|
|
|
instance += FUNCTION_UNITS_SIZE;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
unit_last_insn[instance] = insn;
|
|
|
|
|
unit_tick[instance] = (clock + function_units[unit].max_blockage);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
for (i = 0, unit = ~unit; unit; i++, unit >>= 1)
|
|
|
|
|
if ((unit & 1) != 0)
|
|
|
|
|
schedule_unit (i, insn, clock);
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-30 00:34:36 +02:00
|
|
|
|
/* Return the actual hazard cost of executing INSN on the units
|
|
|
|
|
encoded by UNIT at time CLOCK if the previous actual hazard cost
|
|
|
|
|
was COST. The scheduler using only DFA description should never
|
|
|
|
|
use the following function. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
1998-05-12 14:20:18 +02:00
|
|
|
|
HAIFA_INLINE static int
|
1997-08-12 06:07:19 +02:00
|
|
|
|
actual_hazard (unit, insn, clock, cost)
|
|
|
|
|
int unit, clock, cost;
|
|
|
|
|
rtx insn;
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
if (unit >= 0)
|
|
|
|
|
{
|
|
|
|
|
/* Find the instance of the function unit with the minimum hazard. */
|
|
|
|
|
int instance = unit;
|
|
|
|
|
int best_cost = actual_hazard_this_instance (unit, instance, insn,
|
|
|
|
|
clock, cost);
|
1999-09-14 20:44:10 +02:00
|
|
|
|
#if MAX_MULTIPLICITY > 1
|
1997-08-12 06:07:19 +02:00
|
|
|
|
int this_cost;
|
|
|
|
|
|
|
|
|
|
if (best_cost > cost)
|
|
|
|
|
{
|
|
|
|
|
for (i = function_units[unit].multiplicity - 1; i > 0; i--)
|
|
|
|
|
{
|
|
|
|
|
instance += FUNCTION_UNITS_SIZE;
|
|
|
|
|
this_cost = actual_hazard_this_instance (unit, instance, insn,
|
|
|
|
|
clock, cost);
|
|
|
|
|
if (this_cost < best_cost)
|
|
|
|
|
{
|
|
|
|
|
best_cost = this_cost;
|
|
|
|
|
if (this_cost <= cost)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
cost = MAX (cost, best_cost);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
for (i = 0, unit = ~unit; unit; i++, unit >>= 1)
|
|
|
|
|
if ((unit & 1) != 0)
|
|
|
|
|
cost = actual_hazard (i, insn, clock, cost);
|
|
|
|
|
|
|
|
|
|
return cost;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return the potential hazard cost of executing an instruction on the
|
2002-04-30 00:34:36 +02:00
|
|
|
|
units encoded by UNIT if the previous potential hazard cost was
|
|
|
|
|
COST. An insn with a large blockage time is chosen in preference
|
|
|
|
|
to one with a smaller time; an insn that uses a unit that is more
|
|
|
|
|
likely to be used is chosen in preference to one with a unit that
|
|
|
|
|
is less used. We are trying to minimize a subsequent actual
|
|
|
|
|
hazard. The scheduler using only DFA description should never use
|
|
|
|
|
the following function. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
1998-05-12 14:20:18 +02:00
|
|
|
|
HAIFA_INLINE static int
|
1997-08-12 06:07:19 +02:00
|
|
|
|
potential_hazard (unit, insn, cost)
|
|
|
|
|
int unit, cost;
|
|
|
|
|
rtx insn;
|
|
|
|
|
{
|
|
|
|
|
int i, ncost;
|
|
|
|
|
unsigned int minb, maxb;
|
|
|
|
|
|
|
|
|
|
if (unit >= 0)
|
|
|
|
|
{
|
|
|
|
|
minb = maxb = function_units[unit].max_blockage;
|
|
|
|
|
if (maxb > 1)
|
|
|
|
|
{
|
|
|
|
|
if (function_units[unit].blockage_range_function)
|
|
|
|
|
{
|
|
|
|
|
maxb = minb = blockage_range (unit, insn);
|
|
|
|
|
maxb = MAX_BLOCKAGE_COST (maxb);
|
|
|
|
|
minb = MIN_BLOCKAGE_COST (minb);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (maxb > 1)
|
|
|
|
|
{
|
|
|
|
|
/* Make the number of instructions left dominate. Make the
|
|
|
|
|
minimum delay dominate the maximum delay. If all these
|
|
|
|
|
are the same, use the unit number to add an arbitrary
|
|
|
|
|
ordering. Other terms can be added. */
|
|
|
|
|
ncost = minb * 0x40 + maxb;
|
|
|
|
|
ncost *= (unit_n_insns[unit] - 1) * 0x1000 + unit;
|
|
|
|
|
if (ncost > cost)
|
|
|
|
|
cost = ncost;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
for (i = 0, unit = ~unit; unit; i++, unit >>= 1)
|
|
|
|
|
if ((unit & 1) != 0)
|
|
|
|
|
cost = potential_hazard (i, insn, cost);
|
|
|
|
|
|
|
|
|
|
return cost;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Compute cost of executing INSN given the dependence LINK on the insn USED.
|
|
|
|
|
This is the number of cycles between instruction issue and
|
|
|
|
|
instruction results. */
|
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
HAIFA_INLINE int
|
1997-08-12 06:07:19 +02:00
|
|
|
|
insn_cost (insn, link, used)
|
|
|
|
|
rtx insn, link, used;
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
int cost = INSN_COST (insn);
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2002-04-30 00:34:36 +02:00
|
|
|
|
if (cost < 0)
|
1997-08-12 06:07:19 +02:00
|
|
|
|
{
|
2002-04-30 00:34:36 +02:00
|
|
|
|
/* A USE insn, or something else we don't need to
|
|
|
|
|
understand. We can't pass these directly to
|
|
|
|
|
result_ready_cost or insn_default_latency because it will
|
|
|
|
|
trigger a fatal error for unrecognizable insns. */
|
|
|
|
|
if (recog_memoized (insn) < 0)
|
1997-08-12 06:07:19 +02:00
|
|
|
|
{
|
2002-04-30 00:34:36 +02:00
|
|
|
|
INSN_COST (insn) = 0;
|
|
|
|
|
return 0;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2002-04-30 00:34:36 +02:00
|
|
|
|
if (targetm.sched.use_dfa_pipeline_interface
|
|
|
|
|
&& (*targetm.sched.use_dfa_pipeline_interface) ())
|
|
|
|
|
cost = insn_default_latency (insn);
|
|
|
|
|
else
|
|
|
|
|
cost = result_ready_cost (insn);
|
|
|
|
|
|
|
|
|
|
if (cost < 0)
|
|
|
|
|
cost = 0;
|
|
|
|
|
|
1997-08-12 06:07:19 +02:00
|
|
|
|
INSN_COST (insn) = cost;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1999-09-06 23:55:23 +02:00
|
|
|
|
/* In this case estimate cost without caring how insn is used. */
|
2002-04-30 00:34:36 +02:00
|
|
|
|
if (link == 0 || used == 0)
|
1997-08-12 06:07:19 +02:00
|
|
|
|
return cost;
|
|
|
|
|
|
2002-04-30 00:34:36 +02:00
|
|
|
|
/* A USE insn should never require the value used to be computed.
|
|
|
|
|
This allows the computation of a function's result and parameter
|
|
|
|
|
values to overlap the return and call. */
|
|
|
|
|
if (recog_memoized (used) < 0)
|
1999-07-21 03:15:47 +02:00
|
|
|
|
cost = 0;
|
2002-04-30 00:34:36 +02:00
|
|
|
|
else
|
1997-08-12 06:07:19 +02:00
|
|
|
|
{
|
2002-04-30 00:34:36 +02:00
|
|
|
|
if (targetm.sched.use_dfa_pipeline_interface
|
|
|
|
|
&& (*targetm.sched.use_dfa_pipeline_interface) ())
|
1999-07-21 03:15:47 +02:00
|
|
|
|
{
|
2002-04-30 00:34:36 +02:00
|
|
|
|
if (INSN_CODE (insn) >= 0)
|
|
|
|
|
{
|
|
|
|
|
if (REG_NOTE_KIND (link) == REG_DEP_ANTI)
|
|
|
|
|
cost = 0;
|
|
|
|
|
else if (REG_NOTE_KIND (link) == REG_DEP_OUTPUT)
|
|
|
|
|
{
|
|
|
|
|
cost = (insn_default_latency (insn)
|
|
|
|
|
- insn_default_latency (used));
|
|
|
|
|
if (cost <= 0)
|
|
|
|
|
cost = 1;
|
|
|
|
|
}
|
|
|
|
|
else if (bypass_p (insn))
|
|
|
|
|
cost = insn_latency (insn, used);
|
|
|
|
|
}
|
1999-07-21 03:15:47 +02:00
|
|
|
|
}
|
2001-08-30 22:44:51 +02:00
|
|
|
|
|
2002-04-30 00:34:36 +02:00
|
|
|
|
if (targetm.sched.adjust_cost)
|
|
|
|
|
cost = (*targetm.sched.adjust_cost) (used, link, insn, cost);
|
|
|
|
|
|
|
|
|
|
if (cost < 0)
|
|
|
|
|
cost = 0;
|
|
|
|
|
}
|
|
|
|
|
|
1997-08-12 06:07:19 +02:00
|
|
|
|
return cost;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Compute the priority number for INSN. */
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
priority (insn)
|
|
|
|
|
rtx insn;
|
|
|
|
|
{
|
|
|
|
|
rtx link;
|
|
|
|
|
|
2000-08-04 22:28:08 +02:00
|
|
|
|
if (! INSN_P (insn))
|
1997-08-12 06:07:19 +02:00
|
|
|
|
return 0;
|
|
|
|
|
|
2001-03-01 14:21:30 +01:00
|
|
|
|
if (! INSN_PRIORITY_KNOWN (insn))
|
1997-08-12 06:07:19 +02:00
|
|
|
|
{
|
2001-03-01 14:21:30 +01:00
|
|
|
|
int this_priority = 0;
|
|
|
|
|
|
1997-08-12 06:07:19 +02:00
|
|
|
|
if (INSN_DEPEND (insn) == 0)
|
|
|
|
|
this_priority = insn_cost (insn, 0, 0);
|
|
|
|
|
else
|
2001-03-01 14:21:30 +01:00
|
|
|
|
{
|
|
|
|
|
for (link = INSN_DEPEND (insn); link; link = XEXP (link, 1))
|
|
|
|
|
{
|
|
|
|
|
rtx next;
|
|
|
|
|
int next_priority;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2001-03-01 14:21:30 +01:00
|
|
|
|
if (RTX_INTEGRATED_P (link))
|
|
|
|
|
continue;
|
1997-12-15 08:05:04 +01:00
|
|
|
|
|
2001-03-01 14:21:30 +01:00
|
|
|
|
next = XEXP (link, 0);
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2001-03-01 14:21:30 +01:00
|
|
|
|
/* Critical path is meaningful in block boundaries only. */
|
|
|
|
|
if (! (*current_sched_info->contributes_to_priority) (next, insn))
|
|
|
|
|
continue;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2001-03-01 14:21:30 +01:00
|
|
|
|
next_priority = insn_cost (insn, link, next) + priority (next);
|
|
|
|
|
if (next_priority > this_priority)
|
|
|
|
|
this_priority = next_priority;
|
|
|
|
|
}
|
|
|
|
|
}
|
1997-08-12 06:07:19 +02:00
|
|
|
|
INSN_PRIORITY (insn) = this_priority;
|
2001-03-01 14:21:30 +01:00
|
|
|
|
INSN_PRIORITY_KNOWN (insn) = 1;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
}
|
2001-03-01 14:21:30 +01:00
|
|
|
|
|
|
|
|
|
return INSN_PRIORITY (insn);
|
1997-08-12 06:07:19 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Macros and functions for keeping the priority queue sorted, and
|
|
|
|
|
dealing with queueing and dequeueing of instructions. */
|
|
|
|
|
|
|
|
|
|
#define SCHED_SORT(READY, N_READY) \
|
|
|
|
|
do { if ((N_READY) == 2) \
|
|
|
|
|
swap_sort (READY, N_READY); \
|
|
|
|
|
else if ((N_READY) > 2) \
|
|
|
|
|
qsort (READY, N_READY, sizeof (rtx), rank_for_schedule); } \
|
|
|
|
|
while (0)
|
|
|
|
|
|
|
|
|
|
/* Returns a positive value if x is preferred; returns a negative value if
|
|
|
|
|
y is preferred. Should never return 0, since that will make the sort
|
|
|
|
|
unstable. */
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
rank_for_schedule (x, y)
|
gansidecl.h (__attribute__, [...]): Delete.
* gansidecl.h (__attribute__, ATTRIBUTE_UNUSED_LABEL,
ATTRIBUTE_UNUSED, ATTRIBUTE_NORETURN, ATTRIBUTE_PRINTF,
ATTRIBUTE_PRINTF_1, ATTRIBUTE_PRINTF_2, ATTRIBUTE_PRINTF_3,
ATTRIBUTE_PRINTF_4, ATTRIBUTE_PRINTF_5, GENERIC_PTR): Delete.
* c-decl.c (field_decl_cmp): Use PTR instead of GENERIC_PTR.
* cccp.c (pcfinclude): Likewise.
* global.c (allocno_compare): Likewise.
* haifa-sched.c (rank_for_schedule): Likewise.
* local-alloc.c (qty_sugg_compare_1, qty_compare_1): Likewise.
* reload1.c (hard_reg_use_compare, reload_reg_class_lower): Likewise.
* stupid.c (stupid_reg_compare): Likewise.
* tree.c (_obstack_allocated_p): Likewise.
* varray.h (varray_data_tag, VARRAY_GENERIC_PTR_INIT): Likewise.
From-SVN: r29208
1999-09-08 17:44:18 +02:00
|
|
|
|
const PTR x;
|
|
|
|
|
const PTR y;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
{
|
2000-09-12 18:19:18 +02:00
|
|
|
|
rtx tmp = *(const rtx *) y;
|
|
|
|
|
rtx tmp2 = *(const rtx *) x;
|
2002-05-04 02:38:36 +02:00
|
|
|
|
rtx link;
|
1998-06-05 13:32:28 +02:00
|
|
|
|
int tmp_class, tmp2_class, depend_count1, depend_count2;
|
2000-12-03 13:53:49 +01:00
|
|
|
|
int val, priority_val, weight_val, info_val;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
1999-09-06 23:55:23 +02:00
|
|
|
|
/* Prefer insn with higher priority. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
priority_val = INSN_PRIORITY (tmp2) - INSN_PRIORITY (tmp);
|
|
|
|
|
if (priority_val)
|
|
|
|
|
return priority_val;
|
|
|
|
|
|
1999-09-06 23:55:23 +02:00
|
|
|
|
/* Prefer an insn with smaller contribution to registers-pressure. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
if (!reload_completed &&
|
|
|
|
|
(weight_val = INSN_REG_WEIGHT (tmp) - INSN_REG_WEIGHT (tmp2)))
|
|
|
|
|
return (weight_val);
|
|
|
|
|
|
2000-12-03 13:53:49 +01:00
|
|
|
|
info_val = (*current_sched_info->rank) (tmp, tmp2);
|
|
|
|
|
if (info_val)
|
|
|
|
|
return info_val;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
1999-09-06 23:55:23 +02:00
|
|
|
|
/* Compare insns based on their relation to the last-scheduled-insn. */
|
2002-05-04 02:38:36 +02:00
|
|
|
|
if (last_scheduled_insn)
|
1997-08-12 06:07:19 +02:00
|
|
|
|
{
|
|
|
|
|
/* Classify the instructions into three classes:
|
|
|
|
|
1) Data dependent on last schedule insn.
|
|
|
|
|
2) Anti/Output dependent on last scheduled insn.
|
|
|
|
|
3) Independent of last scheduled insn, or has latency of one.
|
|
|
|
|
Choose the insn from the highest numbered class if different. */
|
2002-05-04 02:38:36 +02:00
|
|
|
|
link = find_insn_list (tmp, INSN_DEPEND (last_scheduled_insn));
|
|
|
|
|
if (link == 0 || insn_cost (last_scheduled_insn, link, tmp) == 1)
|
1997-08-12 06:07:19 +02:00
|
|
|
|
tmp_class = 3;
|
|
|
|
|
else if (REG_NOTE_KIND (link) == 0) /* Data dependence. */
|
|
|
|
|
tmp_class = 1;
|
|
|
|
|
else
|
|
|
|
|
tmp_class = 2;
|
|
|
|
|
|
2002-05-04 02:38:36 +02:00
|
|
|
|
link = find_insn_list (tmp2, INSN_DEPEND (last_scheduled_insn));
|
|
|
|
|
if (link == 0 || insn_cost (last_scheduled_insn, link, tmp2) == 1)
|
1997-08-12 06:07:19 +02:00
|
|
|
|
tmp2_class = 3;
|
|
|
|
|
else if (REG_NOTE_KIND (link) == 0) /* Data dependence. */
|
|
|
|
|
tmp2_class = 1;
|
|
|
|
|
else
|
|
|
|
|
tmp2_class = 2;
|
|
|
|
|
|
|
|
|
|
if ((val = tmp2_class - tmp_class))
|
|
|
|
|
return val;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-12 18:19:18 +02:00
|
|
|
|
/* Prefer the insn which has more later insns that depend on it.
|
1998-06-05 13:32:28 +02:00
|
|
|
|
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;
|
2000-09-12 18:19:18 +02:00
|
|
|
|
|
1997-08-12 06:07:19 +02:00
|
|
|
|
/* 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. */
|
|
|
|
|
return INSN_LUID (tmp) - INSN_LUID (tmp2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Resort the array A in which only element at index N may be out of order. */
|
|
|
|
|
|
1998-05-12 14:20:18 +02:00
|
|
|
|
HAIFA_INLINE static void
|
1997-08-12 06:07:19 +02:00
|
|
|
|
swap_sort (a, n)
|
|
|
|
|
rtx *a;
|
|
|
|
|
int n;
|
|
|
|
|
{
|
|
|
|
|
rtx insn = a[n - 1];
|
|
|
|
|
int i = n - 2;
|
|
|
|
|
|
|
|
|
|
while (i >= 0 && rank_for_schedule (a + i, &insn) >= 0)
|
|
|
|
|
{
|
|
|
|
|
a[i + 1] = a[i];
|
|
|
|
|
i -= 1;
|
|
|
|
|
}
|
|
|
|
|
a[i + 1] = insn;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Add INSN to the insn queue so that it can be executed at least
|
|
|
|
|
N_CYCLES after the currently executing insn. Preserve insns
|
|
|
|
|
chain for debugging purposes. */
|
|
|
|
|
|
1998-05-12 14:20:18 +02:00
|
|
|
|
HAIFA_INLINE static void
|
1997-08-12 06:07:19 +02:00
|
|
|
|
queue_insn (insn, n_cycles)
|
|
|
|
|
rtx insn;
|
|
|
|
|
int n_cycles;
|
|
|
|
|
{
|
|
|
|
|
int next_q = NEXT_Q_AFTER (q_ptr, n_cycles);
|
1998-03-05 03:15:23 +01:00
|
|
|
|
rtx link = alloc_INSN_LIST (insn, insn_queue[next_q]);
|
1997-08-12 06:07:19 +02:00
|
|
|
|
insn_queue[next_q] = link;
|
|
|
|
|
q_size += 1;
|
|
|
|
|
|
|
|
|
|
if (sched_verbose >= 2)
|
|
|
|
|
{
|
2000-12-03 13:53:49 +01:00
|
|
|
|
fprintf (sched_dump, ";;\t\tReady-->Q: insn %s: ",
|
|
|
|
|
(*current_sched_info->print_insn) (insn, 0));
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-12-02 11:47:42 +01:00
|
|
|
|
fprintf (sched_dump, "queued for %d cycles.\n", n_cycles);
|
1997-08-12 06:07:19 +02:00
|
|
|
|
}
|
2000-11-24 18:36:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return a pointer to the bottom of the ready list, i.e. the insn
|
|
|
|
|
with the lowest priority. */
|
|
|
|
|
|
|
|
|
|
HAIFA_INLINE static rtx *
|
|
|
|
|
ready_lastpos (ready)
|
|
|
|
|
struct ready_list *ready;
|
|
|
|
|
{
|
|
|
|
|
if (ready->n_ready == 0)
|
|
|
|
|
abort ();
|
|
|
|
|
return ready->vec + ready->first - ready->n_ready + 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Add an element INSN to the ready list so that it ends up with the lowest
|
|
|
|
|
priority. */
|
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
HAIFA_INLINE void
|
2000-11-24 18:36:47 +01:00
|
|
|
|
ready_add (ready, insn)
|
|
|
|
|
struct ready_list *ready;
|
|
|
|
|
rtx insn;
|
|
|
|
|
{
|
|
|
|
|
if (ready->first == ready->n_ready)
|
|
|
|
|
{
|
|
|
|
|
memmove (ready->vec + ready->veclen - ready->n_ready,
|
|
|
|
|
ready_lastpos (ready),
|
|
|
|
|
ready->n_ready * sizeof (rtx));
|
|
|
|
|
ready->first = ready->veclen - 1;
|
|
|
|
|
}
|
|
|
|
|
ready->vec[ready->first - ready->n_ready] = insn;
|
|
|
|
|
ready->n_ready++;
|
|
|
|
|
}
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-11-24 18:36:47 +01:00
|
|
|
|
/* Remove the element with the highest priority from the ready list and
|
|
|
|
|
return it. */
|
|
|
|
|
|
|
|
|
|
HAIFA_INLINE static rtx
|
|
|
|
|
ready_remove_first (ready)
|
|
|
|
|
struct ready_list *ready;
|
|
|
|
|
{
|
|
|
|
|
rtx t;
|
|
|
|
|
if (ready->n_ready == 0)
|
|
|
|
|
abort ();
|
|
|
|
|
t = ready->vec[ready->first--];
|
|
|
|
|
ready->n_ready--;
|
|
|
|
|
/* If the queue becomes empty, reset it. */
|
|
|
|
|
if (ready->n_ready == 0)
|
|
|
|
|
ready->first = ready->veclen - 1;
|
|
|
|
|
return t;
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-30 00:34:36 +02:00
|
|
|
|
/* The following code implements multi-pass scheduling for the first
|
|
|
|
|
cycle. In other words, we will try to choose ready insn which
|
|
|
|
|
permits to start maximum number of insns on the same cycle. */
|
|
|
|
|
|
|
|
|
|
/* Return a pointer to the element INDEX from the ready. INDEX for
|
|
|
|
|
insn with the highest priority is 0, and the lowest priority has
|
|
|
|
|
N_READY - 1. */
|
|
|
|
|
|
|
|
|
|
HAIFA_INLINE static rtx
|
|
|
|
|
ready_element (ready, index)
|
|
|
|
|
struct ready_list *ready;
|
|
|
|
|
int index;
|
|
|
|
|
{
|
|
|
|
|
if (ready->n_ready == 0 || index >= ready->n_ready)
|
|
|
|
|
abort ();
|
|
|
|
|
return ready->vec[ready->first - index];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Remove the element INDEX from the ready list and return it. INDEX
|
|
|
|
|
for insn with the highest priority is 0, and the lowest priority
|
|
|
|
|
has N_READY - 1. */
|
|
|
|
|
|
|
|
|
|
HAIFA_INLINE static rtx
|
|
|
|
|
ready_remove (ready, index)
|
|
|
|
|
struct ready_list *ready;
|
|
|
|
|
int index;
|
|
|
|
|
{
|
|
|
|
|
rtx t;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
if (index == 0)
|
|
|
|
|
return ready_remove_first (ready);
|
|
|
|
|
if (ready->n_ready == 0 || index >= ready->n_ready)
|
|
|
|
|
abort ();
|
|
|
|
|
t = ready->vec[ready->first - index];
|
|
|
|
|
ready->n_ready--;
|
|
|
|
|
for (i = index; i < ready->n_ready; i++)
|
|
|
|
|
ready->vec[ready->first - i] = ready->vec[ready->first - i - 1];
|
|
|
|
|
return t;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2000-11-24 18:36:47 +01:00
|
|
|
|
/* Sort the ready list READY by ascending priority, using the SCHED_SORT
|
|
|
|
|
macro. */
|
|
|
|
|
|
|
|
|
|
HAIFA_INLINE static void
|
|
|
|
|
ready_sort (ready)
|
|
|
|
|
struct ready_list *ready;
|
|
|
|
|
{
|
|
|
|
|
rtx *first = ready_lastpos (ready);
|
|
|
|
|
SCHED_SORT (first, ready->n_ready);
|
1997-08-12 06:07:19 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* PREV is an insn that is ready to execute. Adjust its priority if that
|
1999-10-11 01:45:27 +02:00
|
|
|
|
will help shorten or lengthen register lifetimes as appropriate. Also
|
|
|
|
|
provide a hook for the target to tweek itself. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
1998-05-12 14:20:18 +02:00
|
|
|
|
HAIFA_INLINE static void
|
1997-08-12 06:07:19 +02:00
|
|
|
|
adjust_priority (prev)
|
haifa-sched.c: Convert to target hooks.
* 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.
From-SVN: r45009
2001-08-18 22:25:54 +02:00
|
|
|
|
rtx prev;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
{
|
1999-10-11 01:45:27 +02:00
|
|
|
|
/* ??? 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
|
2000-09-12 18:19:18 +02:00
|
|
|
|
notes, which we removed in schedule_region. Nor did it try to
|
1999-10-11 01:45:27 +02:00
|
|
|
|
take into account register pressure or anything useful like that.
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
1999-10-11 01:45:27 +02:00
|
|
|
|
Revisit when we have a machine model to work with and not before. */
|
1999-07-21 03:15:47 +02:00
|
|
|
|
|
haifa-sched.c: Convert to target hooks.
* 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.
From-SVN: r45009
2001-08-18 22:25:54 +02:00
|
|
|
|
if (targetm.sched.adjust_priority)
|
|
|
|
|
INSN_PRIORITY (prev) =
|
|
|
|
|
(*targetm.sched.adjust_priority) (prev, INSN_PRIORITY (prev));
|
1997-08-12 06:07:19 +02:00
|
|
|
|
}
|
|
|
|
|
|
2002-04-30 00:34:36 +02:00
|
|
|
|
/* Advance time on one cycle. */
|
|
|
|
|
HAIFA_INLINE static void
|
|
|
|
|
advance_one_cycle ()
|
|
|
|
|
{
|
|
|
|
|
if (targetm.sched.use_dfa_pipeline_interface
|
|
|
|
|
&& (*targetm.sched.use_dfa_pipeline_interface) ())
|
|
|
|
|
{
|
|
|
|
|
if (targetm.sched.dfa_pre_cycle_insn)
|
|
|
|
|
state_transition (curr_state,
|
|
|
|
|
(*targetm.sched.dfa_pre_cycle_insn) ());
|
|
|
|
|
|
|
|
|
|
state_transition (curr_state, NULL);
|
|
|
|
|
|
|
|
|
|
if (targetm.sched.dfa_post_cycle_insn)
|
|
|
|
|
state_transition (curr_state,
|
|
|
|
|
(*targetm.sched.dfa_post_cycle_insn) ());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1998-08-26 20:47:42 +02:00
|
|
|
|
/* Clock at which the previous instruction was issued. */
|
|
|
|
|
static int last_clock_var;
|
|
|
|
|
|
1997-08-12 06:07:19 +02:00
|
|
|
|
/* INSN is the "currently executing insn". Launch each insn which was
|
2000-11-24 18:36:47 +01:00
|
|
|
|
waiting on INSN. READY is the ready list which contains the insns
|
|
|
|
|
that are ready to fire. CLOCK is the current cycle.
|
|
|
|
|
*/
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-11-24 18:36:47 +01:00
|
|
|
|
static void
|
|
|
|
|
schedule_insn (insn, ready, clock)
|
1997-08-12 06:07:19 +02:00
|
|
|
|
rtx insn;
|
2000-11-24 18:36:47 +01:00
|
|
|
|
struct ready_list *ready;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
int clock;
|
|
|
|
|
{
|
|
|
|
|
rtx link;
|
2002-04-30 00:34:36 +02:00
|
|
|
|
int unit = 0;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2002-04-30 00:34:36 +02:00
|
|
|
|
if (!targetm.sched.use_dfa_pipeline_interface
|
|
|
|
|
|| !(*targetm.sched.use_dfa_pipeline_interface) ())
|
|
|
|
|
unit = insn_unit (insn);
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2002-05-03 02:05:52 +02:00
|
|
|
|
if (targetm.sched.use_dfa_pipeline_interface
|
|
|
|
|
&& (*targetm.sched.use_dfa_pipeline_interface) ()
|
|
|
|
|
&& sched_verbose >= 1)
|
1997-08-12 06:07:19 +02:00
|
|
|
|
{
|
2002-05-03 02:05:52 +02:00
|
|
|
|
char buf[2048];
|
2002-04-30 00:34:36 +02:00
|
|
|
|
|
2002-05-03 02:05:52 +02:00
|
|
|
|
print_insn (buf, insn, 0);
|
|
|
|
|
buf[40]=0;
|
|
|
|
|
fprintf (sched_dump, ";;\t%3i--> %-40s:", clock, buf);
|
2002-04-30 00:34:36 +02:00
|
|
|
|
|
2002-05-03 02:05:52 +02:00
|
|
|
|
if (recog_memoized (insn) < 0)
|
|
|
|
|
fprintf (sched_dump, "nothing");
|
|
|
|
|
else
|
|
|
|
|
print_reservation (sched_dump, insn);
|
|
|
|
|
fputc ('\n', sched_dump);
|
|
|
|
|
}
|
|
|
|
|
else if (sched_verbose >= 2)
|
|
|
|
|
{
|
|
|
|
|
fprintf (sched_dump, ";;\t\t--> scheduling insn <<<%d>>> on unit ",
|
|
|
|
|
INSN_UID (insn));
|
|
|
|
|
insn_print_units (insn);
|
|
|
|
|
fputc ('\n', sched_dump);
|
1997-08-12 06:07:19 +02:00
|
|
|
|
}
|
|
|
|
|
|
2002-04-30 00:34:36 +02:00
|
|
|
|
if (!targetm.sched.use_dfa_pipeline_interface
|
|
|
|
|
|| !(*targetm.sched.use_dfa_pipeline_interface) ())
|
|
|
|
|
{
|
|
|
|
|
if (sched_verbose && unit == -1)
|
|
|
|
|
visualize_no_unit (insn);
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
|
|
|
|
|
2002-04-30 00:34:36 +02:00
|
|
|
|
if (MAX_BLOCKAGE > 1 || issue_rate > 1 || sched_verbose)
|
|
|
|
|
schedule_unit (unit, insn, clock);
|
|
|
|
|
|
|
|
|
|
if (INSN_DEPEND (insn) == 0)
|
|
|
|
|
return;
|
|
|
|
|
}
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
|
|
|
|
for (link = INSN_DEPEND (insn); link != 0; link = XEXP (link, 1))
|
|
|
|
|
{
|
|
|
|
|
rtx next = XEXP (link, 0);
|
|
|
|
|
int cost = insn_cost (insn, link, next);
|
|
|
|
|
|
|
|
|
|
INSN_TICK (next) = MAX (INSN_TICK (next), clock + cost);
|
|
|
|
|
|
|
|
|
|
if ((INSN_DEP_COUNT (next) -= 1) == 0)
|
|
|
|
|
{
|
|
|
|
|
int effective_cost = INSN_TICK (next) - clock;
|
|
|
|
|
|
2000-12-03 13:53:49 +01:00
|
|
|
|
if (! (*current_sched_info->new_ready) (next))
|
1997-08-12 06:07:19 +02:00
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (sched_verbose >= 2)
|
|
|
|
|
{
|
2000-12-03 13:53:49 +01:00
|
|
|
|
fprintf (sched_dump, ";;\t\tdependences resolved: insn %s ",
|
|
|
|
|
(*current_sched_info->print_insn) (next, 0));
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
1999-07-21 03:15:47 +02:00
|
|
|
|
if (effective_cost < 1)
|
2000-12-02 11:47:42 +01:00
|
|
|
|
fprintf (sched_dump, "into ready\n");
|
1997-08-12 06:07:19 +02:00
|
|
|
|
else
|
2000-12-02 11:47:42 +01:00
|
|
|
|
fprintf (sched_dump, "into queue with cost=%d\n", effective_cost);
|
1997-08-12 06:07:19 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Adjust the priority of NEXT and either put it on the ready
|
|
|
|
|
list or queue it. */
|
|
|
|
|
adjust_priority (next);
|
1999-07-21 03:15:47 +02:00
|
|
|
|
if (effective_cost < 1)
|
2000-11-24 18:36:47 +01:00
|
|
|
|
ready_add (ready, next);
|
1997-08-12 06:07:19 +02:00
|
|
|
|
else
|
|
|
|
|
queue_insn (next, effective_cost);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-12 18:19:18 +02:00
|
|
|
|
/* Annotate the instruction with issue information -- TImode
|
1998-08-26 20:47:42 +02:00
|
|
|
|
indicates that the instruction is expected not to be able
|
|
|
|
|
to issue on the same cycle as the previous insn. A machine
|
|
|
|
|
may use this information to decide how the instruction should
|
|
|
|
|
be aligned. */
|
2002-04-30 00:34:36 +02:00
|
|
|
|
if (reload_completed && issue_rate > 1
|
|
|
|
|
&& GET_CODE (PATTERN (insn)) != USE
|
|
|
|
|
&& GET_CODE (PATTERN (insn)) != CLOBBER)
|
1998-08-26 20:47:42 +02:00
|
|
|
|
{
|
|
|
|
|
PUT_MODE (insn, clock > last_clock_var ? TImode : VOIDmode);
|
|
|
|
|
last_clock_var = clock;
|
|
|
|
|
}
|
1997-08-12 06:07:19 +02:00
|
|
|
|
}
|
|
|
|
|
|
1999-09-06 23:55:23 +02:00
|
|
|
|
/* Functions for handling of notes. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
|
|
|
|
/* Delete notes beginning with INSN and put them in the chain
|
|
|
|
|
of notes ended by NOTE_LIST.
|
|
|
|
|
Returns the insn following the notes. */
|
|
|
|
|
|
|
|
|
|
static rtx
|
|
|
|
|
unlink_other_notes (insn, tail)
|
|
|
|
|
rtx insn, tail;
|
|
|
|
|
{
|
|
|
|
|
rtx prev = PREV_INSN (insn);
|
|
|
|
|
|
|
|
|
|
while (insn != tail && GET_CODE (insn) == NOTE)
|
|
|
|
|
{
|
|
|
|
|
rtx next = NEXT_INSN (insn);
|
|
|
|
|
/* Delete the note from its current position. */
|
|
|
|
|
if (prev)
|
|
|
|
|
NEXT_INSN (prev) = next;
|
|
|
|
|
if (next)
|
|
|
|
|
PREV_INSN (next) = prev;
|
|
|
|
|
|
1999-10-11 01:45:27 +02:00
|
|
|
|
/* See sched_analyze to see how these are handled. */
|
2001-08-07 22:24:08 +02:00
|
|
|
|
if (NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_BEG
|
1997-08-12 06:07:19 +02:00
|
|
|
|
&& NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_END
|
2000-04-21 21:32:10 +02:00
|
|
|
|
&& NOTE_LINE_NUMBER (insn) != NOTE_INSN_RANGE_BEG
|
Makefile.in (HOST_RTL): Add $(HOST_PREFIX)bitmap.o.
* Makefile.in (HOST_RTL): Add $(HOST_PREFIX)bitmap.o.
(rtl.o, emit-rtl.o): Add dependency on bitmap.h.
($(HOST_PREFIX_1)rtl.o): Likewise.
($(HOST_PREFIX_1)bitmap.o): New host object.
* emit-rtl.c (toplevel): Include bitmap.h.
(gen_rtx): Handle 't' and 'b' nodes.
* print-rtl.c (print_rtx): Handle printing NOTE_INSN_LIVE notes.
Print block number for block begin/end notes. Print 't' type
nodes as a pointer. Know that the 3rd argument of live range
start/stop notes is really a range_info rtx. If type is 'b', print
out argument as a bitmap.
* rtl.c: Include bitmap.c.
(copy_rtx): Copy tree nodes as is. Copy bitmaps if type is 'b'.
(note_insn_name): Add NOTE_INSN_RANGE_{START,END}, NOTE_INSN_LIVE.
* rtl.def (RANGE_LIVE): New node to hold live information while we
recalculate the basic blocks.
(RANGE_REG, RANGE_INFO): New rtl types for live range splitting.
(RANGE_VAR): New node, to hold information saved in symbol node for New
communicating live range information to the debug output functions.
* rtl.h (rtunion_def): Add rttree and rtbit fields.
(XBITMAP, XTREE): New accessor macros.
(NOTE_LIVE_INFO): Overload NOTE_SOURCE_FILE for NOTE_INSN_LIVE notes.
(NOTE_RANGE_INFO): Similarly for NOTE_INSN_RANGE_{START,END} notes.
(NOTE_BLOCK_LIVE_RANGE_BLOCK): Define.
(NOTE_INSN_RANGE_START, NOTE_INSN_RANGE_END, NOTE_INSN_LIVE): New notes.
(RANGE_LIVE_{BITMAP,ORIG_BLOCK}): New accessor macros.
(RANGE_REG_{SYMBOL,BLOCK}_NODE, RANGE_VAR_*): New accessor macros.
(RANGE_INFO_*): Likewise.
* sched.c (sched_analyze): Keep live range start/stop notes.
(unlink_other_notes): Likewise.
* haifa-sched.c (sched_analyze): Keep live range start/stop notes.
(unlink_other_notes): Likewise.
* tree.h (BLOCK_LIVE_RANGE_{START,END,VAR_FLAG}): New accessor macros.
(BLOCK_LIVE_RANGE_FLAG): Likewise.
(DECL_LIVE_RANGE_RTL): Likewise.
(struct tree_block): Add live_range_flag, live_range_var_flag,
live_range_start and live_range_end.
(struct tree_decl): Add live_range_rtl field.
* gengenrtl.c (type_from_format): Handle 'b' and 't'.
(accessor_from_format): Likewise.
Co-Authored-By: Jeffrey A Law <law@cygnus.com>
From-SVN: r19727
1998-05-13 23:13:47 +02:00
|
|
|
|
&& NOTE_LINE_NUMBER (insn) != NOTE_INSN_RANGE_END
|
1997-08-12 06:07:19 +02:00
|
|
|
|
&& NOTE_LINE_NUMBER (insn) != NOTE_INSN_EH_REGION_BEG
|
|
|
|
|
&& NOTE_LINE_NUMBER (insn) != NOTE_INSN_EH_REGION_END)
|
|
|
|
|
{
|
|
|
|
|
/* Insert the note at the end of the notes list. */
|
|
|
|
|
PREV_INSN (insn) = note_list;
|
|
|
|
|
if (note_list)
|
|
|
|
|
NEXT_INSN (note_list) = insn;
|
|
|
|
|
note_list = insn;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
insn = next;
|
|
|
|
|
}
|
|
|
|
|
return insn;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Delete line notes beginning with INSN. Record line-number notes so
|
|
|
|
|
they can be reused. Returns the insn following the notes. */
|
|
|
|
|
|
|
|
|
|
static rtx
|
|
|
|
|
unlink_line_notes (insn, tail)
|
|
|
|
|
rtx insn, tail;
|
|
|
|
|
{
|
|
|
|
|
rtx prev = PREV_INSN (insn);
|
|
|
|
|
|
|
|
|
|
while (insn != tail && GET_CODE (insn) == NOTE)
|
|
|
|
|
{
|
|
|
|
|
rtx next = NEXT_INSN (insn);
|
|
|
|
|
|
|
|
|
|
if (write_symbols != NO_DEBUG && NOTE_LINE_NUMBER (insn) > 0)
|
|
|
|
|
{
|
|
|
|
|
/* Delete the note from its current position. */
|
|
|
|
|
if (prev)
|
|
|
|
|
NEXT_INSN (prev) = next;
|
|
|
|
|
if (next)
|
|
|
|
|
PREV_INSN (next) = prev;
|
|
|
|
|
|
|
|
|
|
/* Record line-number notes so they can be reused. */
|
|
|
|
|
LINE_NOTE (insn) = insn;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
prev = insn;
|
|
|
|
|
|
|
|
|
|
insn = next;
|
|
|
|
|
}
|
|
|
|
|
return insn;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return the head and tail pointers of BB. */
|
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
void
|
1999-10-20 16:04:12 +02:00
|
|
|
|
get_block_head_tail (b, headp, tailp)
|
|
|
|
|
int b;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
rtx *headp;
|
|
|
|
|
rtx *tailp;
|
|
|
|
|
{
|
|
|
|
|
/* HEAD and TAIL delimit the basic block being scheduled. */
|
2000-12-03 13:53:49 +01:00
|
|
|
|
rtx head = BLOCK_HEAD (b);
|
|
|
|
|
rtx tail = BLOCK_END (b);
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
|
|
|
|
/* Don't include any notes or labels at the beginning of the
|
|
|
|
|
basic block, or notes at the ends of basic blocks. */
|
|
|
|
|
while (head != tail)
|
|
|
|
|
{
|
|
|
|
|
if (GET_CODE (head) == NOTE)
|
|
|
|
|
head = NEXT_INSN (head);
|
|
|
|
|
else if (GET_CODE (tail) == NOTE)
|
|
|
|
|
tail = PREV_INSN (tail);
|
|
|
|
|
else if (GET_CODE (head) == CODE_LABEL)
|
|
|
|
|
head = NEXT_INSN (head);
|
|
|
|
|
else
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*headp = head;
|
|
|
|
|
*tailp = tail;
|
|
|
|
|
}
|
|
|
|
|
|
2000-12-03 13:53:49 +01:00
|
|
|
|
/* Return nonzero if there are no real insns in the range [ HEAD, TAIL ]. */
|
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
int
|
2000-12-03 13:53:49 +01:00
|
|
|
|
no_real_insns_p (head, tail)
|
|
|
|
|
rtx head, tail;
|
|
|
|
|
{
|
|
|
|
|
while (head != NEXT_INSN (tail))
|
|
|
|
|
{
|
|
|
|
|
if (GET_CODE (head) != NOTE && GET_CODE (head) != CODE_LABEL)
|
|
|
|
|
return 0;
|
|
|
|
|
head = NEXT_INSN (head);
|
|
|
|
|
}
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2000-12-19 18:41:20 +01:00
|
|
|
|
/* Delete line notes from one block. Save them so they can be later restored
|
|
|
|
|
(in restore_line_notes). HEAD and TAIL are the boundaries of the
|
|
|
|
|
block in which notes should be processed. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
void
|
2000-12-19 18:41:20 +01:00
|
|
|
|
rm_line_notes (head, tail)
|
|
|
|
|
rtx head, tail;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
{
|
|
|
|
|
rtx next_tail;
|
|
|
|
|
rtx insn;
|
|
|
|
|
|
|
|
|
|
next_tail = NEXT_INSN (tail);
|
|
|
|
|
for (insn = head; insn != next_tail; insn = NEXT_INSN (insn))
|
|
|
|
|
{
|
|
|
|
|
rtx prev;
|
|
|
|
|
|
|
|
|
|
/* Farm out notes, and maybe save them in NOTE_LIST.
|
|
|
|
|
This is needed to keep the debugger from
|
|
|
|
|
getting completely deranged. */
|
|
|
|
|
if (GET_CODE (insn) == NOTE)
|
|
|
|
|
{
|
|
|
|
|
prev = insn;
|
|
|
|
|
insn = unlink_line_notes (insn, next_tail);
|
|
|
|
|
|
|
|
|
|
if (prev == tail)
|
|
|
|
|
abort ();
|
|
|
|
|
if (prev == head)
|
|
|
|
|
abort ();
|
|
|
|
|
if (insn == next_tail)
|
|
|
|
|
abort ();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-12-19 18:41:20 +01:00
|
|
|
|
/* Save line number notes for each insn in block B. HEAD and TAIL are
|
2002-01-18 14:40:36 +01:00
|
|
|
|
the boundaries of the block in which notes should be processed. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
void
|
2000-12-19 18:41:20 +01:00
|
|
|
|
save_line_notes (b, head, tail)
|
2000-12-03 20:00:00 +01:00
|
|
|
|
int b;
|
2000-12-19 18:41:20 +01:00
|
|
|
|
rtx head, tail;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
{
|
|
|
|
|
rtx next_tail;
|
|
|
|
|
|
|
|
|
|
/* We must use the true line number for the first insn in the block
|
|
|
|
|
that was computed and saved at the start of this pass. We can't
|
|
|
|
|
use the current line number, because scheduling of the previous
|
|
|
|
|
block may have changed the current line number. */
|
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
rtx line = line_note_head[b];
|
1997-08-12 06:07:19 +02:00
|
|
|
|
rtx insn;
|
|
|
|
|
|
|
|
|
|
next_tail = NEXT_INSN (tail);
|
|
|
|
|
|
2000-12-19 18:41:20 +01:00
|
|
|
|
for (insn = head; insn != next_tail; insn = NEXT_INSN (insn))
|
1997-08-12 06:07:19 +02:00
|
|
|
|
if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > 0)
|
|
|
|
|
line = insn;
|
|
|
|
|
else
|
|
|
|
|
LINE_NOTE (insn) = line;
|
|
|
|
|
}
|
|
|
|
|
|
2001-01-12 19:00:49 +01:00
|
|
|
|
/* After a block was scheduled, insert line notes into the insns list.
|
2000-12-19 18:41:20 +01:00
|
|
|
|
HEAD and TAIL are the boundaries of the block in which notes should
|
2002-01-18 14:40:36 +01:00
|
|
|
|
be processed. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
void
|
2001-01-12 19:00:49 +01:00
|
|
|
|
restore_line_notes (head, tail)
|
2000-12-19 18:41:20 +01:00
|
|
|
|
rtx head, tail;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
{
|
|
|
|
|
rtx line, note, prev, new;
|
|
|
|
|
int added_notes = 0;
|
2000-12-19 18:41:20 +01:00
|
|
|
|
rtx next_tail, insn;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-12-19 18:41:20 +01:00
|
|
|
|
head = head;
|
|
|
|
|
next_tail = NEXT_INSN (tail);
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
|
|
|
|
/* Determine the current line-number. We want to know the current
|
|
|
|
|
line number of the first insn of the block here, in case it is
|
|
|
|
|
different from the true line number that was saved earlier. If
|
|
|
|
|
different, then we need a line number note before the first insn
|
|
|
|
|
of this block. If it happens to be the same, then we don't want to
|
|
|
|
|
emit another line number note here. */
|
|
|
|
|
for (line = head; line; line = PREV_INSN (line))
|
|
|
|
|
if (GET_CODE (line) == NOTE && NOTE_LINE_NUMBER (line) > 0)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* Walk the insns keeping track of the current line-number and inserting
|
|
|
|
|
the line-number notes as needed. */
|
|
|
|
|
for (insn = head; insn != next_tail; insn = NEXT_INSN (insn))
|
|
|
|
|
if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > 0)
|
|
|
|
|
line = insn;
|
|
|
|
|
/* This used to emit line number notes before every non-deleted note.
|
|
|
|
|
However, this confuses a debugger, because line notes not separated
|
|
|
|
|
by real instructions all end up at the same address. I can find no
|
|
|
|
|
use for line number notes before other notes, so none are emitted. */
|
|
|
|
|
else if (GET_CODE (insn) != NOTE
|
2000-12-19 18:41:20 +01:00
|
|
|
|
&& INSN_UID (insn) < old_max_uid
|
1997-08-12 06:07:19 +02:00
|
|
|
|
&& (note = LINE_NOTE (insn)) != 0
|
|
|
|
|
&& note != line
|
|
|
|
|
&& (line == 0
|
|
|
|
|
|| NOTE_LINE_NUMBER (note) != NOTE_LINE_NUMBER (line)
|
|
|
|
|
|| NOTE_SOURCE_FILE (note) != NOTE_SOURCE_FILE (line)))
|
|
|
|
|
{
|
|
|
|
|
line = note;
|
|
|
|
|
prev = PREV_INSN (insn);
|
|
|
|
|
if (LINE_NOTE (note))
|
|
|
|
|
{
|
|
|
|
|
/* Re-use the original line-number note. */
|
|
|
|
|
LINE_NOTE (note) = 0;
|
|
|
|
|
PREV_INSN (note) = prev;
|
|
|
|
|
NEXT_INSN (prev) = note;
|
|
|
|
|
PREV_INSN (insn) = note;
|
|
|
|
|
NEXT_INSN (note) = insn;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
added_notes++;
|
|
|
|
|
new = emit_note_after (NOTE_LINE_NUMBER (note), prev);
|
|
|
|
|
NOTE_SOURCE_FILE (new) = NOTE_SOURCE_FILE (note);
|
|
|
|
|
RTX_INTEGRATED_P (new) = RTX_INTEGRATED_P (note);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (sched_verbose && added_notes)
|
2000-12-02 11:47:42 +01:00
|
|
|
|
fprintf (sched_dump, ";; added %d line-number notes\n", added_notes);
|
1997-08-12 06:07:19 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* After scheduling the function, delete redundant line notes from the
|
|
|
|
|
insns list. */
|
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
void
|
1997-08-12 06:07:19 +02:00
|
|
|
|
rm_redundant_line_notes ()
|
|
|
|
|
{
|
|
|
|
|
rtx line = 0;
|
|
|
|
|
rtx insn = get_insns ();
|
|
|
|
|
int active_insn = 0;
|
|
|
|
|
int notes = 0;
|
|
|
|
|
|
|
|
|
|
/* Walk the insns deleting redundant line-number notes. Many of these
|
|
|
|
|
are already present. The remainder tend to occur at basic
|
|
|
|
|
block boundaries. */
|
|
|
|
|
for (insn = get_last_insn (); insn; insn = PREV_INSN (insn))
|
|
|
|
|
if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > 0)
|
|
|
|
|
{
|
|
|
|
|
/* If there are no active insns following, INSN is redundant. */
|
|
|
|
|
if (active_insn == 0)
|
|
|
|
|
{
|
|
|
|
|
notes++;
|
|
|
|
|
NOTE_SOURCE_FILE (insn) = 0;
|
|
|
|
|
NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
|
|
|
|
|
}
|
|
|
|
|
/* If the line number is unchanged, LINE is redundant. */
|
|
|
|
|
else if (line
|
|
|
|
|
&& NOTE_LINE_NUMBER (line) == NOTE_LINE_NUMBER (insn)
|
|
|
|
|
&& NOTE_SOURCE_FILE (line) == NOTE_SOURCE_FILE (insn))
|
|
|
|
|
{
|
|
|
|
|
notes++;
|
|
|
|
|
NOTE_SOURCE_FILE (line) = 0;
|
|
|
|
|
NOTE_LINE_NUMBER (line) = NOTE_INSN_DELETED;
|
|
|
|
|
line = insn;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
line = insn;
|
|
|
|
|
active_insn = 0;
|
|
|
|
|
}
|
|
|
|
|
else if (!((GET_CODE (insn) == NOTE
|
|
|
|
|
&& NOTE_LINE_NUMBER (insn) == NOTE_INSN_DELETED)
|
|
|
|
|
|| (GET_CODE (insn) == INSN
|
|
|
|
|
&& (GET_CODE (PATTERN (insn)) == USE
|
|
|
|
|
|| GET_CODE (PATTERN (insn)) == CLOBBER))))
|
|
|
|
|
active_insn++;
|
|
|
|
|
|
|
|
|
|
if (sched_verbose && notes)
|
2000-12-02 11:47:42 +01:00
|
|
|
|
fprintf (sched_dump, ";; deleted %d line-number notes\n", notes);
|
1997-08-12 06:07:19 +02:00
|
|
|
|
}
|
|
|
|
|
|
2000-12-19 18:41:20 +01:00
|
|
|
|
/* Delete notes between HEAD and TAIL and put them in the chain
|
1997-08-12 06:07:19 +02:00
|
|
|
|
of notes ended by NOTE_LIST. */
|
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
void
|
1997-08-12 06:07:19 +02:00
|
|
|
|
rm_other_notes (head, tail)
|
|
|
|
|
rtx head;
|
|
|
|
|
rtx tail;
|
|
|
|
|
{
|
|
|
|
|
rtx next_tail;
|
|
|
|
|
rtx insn;
|
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
note_list = 0;
|
2000-08-04 22:28:08 +02:00
|
|
|
|
if (head == tail && (! INSN_P (head)))
|
1997-08-12 06:07:19 +02:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
next_tail = NEXT_INSN (tail);
|
|
|
|
|
for (insn = head; insn != next_tail; insn = NEXT_INSN (insn))
|
|
|
|
|
{
|
|
|
|
|
rtx prev;
|
|
|
|
|
|
|
|
|
|
/* Farm out notes, and maybe save them in NOTE_LIST.
|
|
|
|
|
This is needed to keep the debugger from
|
|
|
|
|
getting completely deranged. */
|
|
|
|
|
if (GET_CODE (insn) == NOTE)
|
|
|
|
|
{
|
|
|
|
|
prev = insn;
|
|
|
|
|
|
|
|
|
|
insn = unlink_other_notes (insn, next_tail);
|
|
|
|
|
|
|
|
|
|
if (prev == tail)
|
|
|
|
|
abort ();
|
|
|
|
|
if (prev == head)
|
|
|
|
|
abort ();
|
|
|
|
|
if (insn == next_tail)
|
|
|
|
|
abort ();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1999-09-06 23:55:23 +02:00
|
|
|
|
/* Functions for computation of registers live/usage info. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
1999-10-11 01:45:27 +02:00
|
|
|
|
/* Calculate INSN_REG_WEIGHT for all insns of a block. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
|
|
|
|
static void
|
1999-10-20 16:04:12 +02:00
|
|
|
|
find_insn_reg_weight (b)
|
2000-09-12 18:19:18 +02:00
|
|
|
|
int b;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
{
|
|
|
|
|
rtx insn, next_tail, head, tail;
|
|
|
|
|
|
1999-10-20 16:04:12 +02:00
|
|
|
|
get_block_head_tail (b, &head, &tail);
|
1997-08-12 06:07:19 +02:00
|
|
|
|
next_tail = NEXT_INSN (tail);
|
|
|
|
|
|
|
|
|
|
for (insn = head; insn != next_tail; insn = NEXT_INSN (insn))
|
|
|
|
|
{
|
|
|
|
|
int reg_weight = 0;
|
1999-10-11 01:45:27 +02:00
|
|
|
|
rtx x;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
|
|
|
|
/* Handle register life information. */
|
2000-08-04 22:28:08 +02:00
|
|
|
|
if (! INSN_P (insn))
|
1997-08-12 06:07:19 +02:00
|
|
|
|
continue;
|
|
|
|
|
|
1999-10-11 01:45:27 +02:00
|
|
|
|
/* Increment weight for each register born here. */
|
|
|
|
|
x = PATTERN (insn);
|
|
|
|
|
if ((GET_CODE (x) == SET || GET_CODE (x) == CLOBBER)
|
|
|
|
|
&& register_operand (SET_DEST (x), VOIDmode))
|
|
|
|
|
reg_weight++;
|
|
|
|
|
else if (GET_CODE (x) == PARALLEL)
|
1997-08-12 06:07:19 +02:00
|
|
|
|
{
|
1999-10-11 01:45:27 +02:00
|
|
|
|
int j;
|
|
|
|
|
for (j = XVECLEN (x, 0) - 1; j >= 0; j--)
|
|
|
|
|
{
|
|
|
|
|
x = XVECEXP (PATTERN (insn), 0, j);
|
|
|
|
|
if ((GET_CODE (x) == SET || GET_CODE (x) == CLOBBER)
|
|
|
|
|
&& register_operand (SET_DEST (x), VOIDmode))
|
|
|
|
|
reg_weight++;
|
|
|
|
|
}
|
1997-08-12 06:07:19 +02:00
|
|
|
|
}
|
|
|
|
|
|
1999-10-11 01:45:27 +02:00
|
|
|
|
/* Decrement weight for each register that dies here. */
|
|
|
|
|
for (x = REG_NOTES (insn); x; x = XEXP (x, 1))
|
1997-08-12 06:07:19 +02:00
|
|
|
|
{
|
1999-10-11 01:45:27 +02:00
|
|
|
|
if (REG_NOTE_KIND (x) == REG_DEAD
|
|
|
|
|
|| REG_NOTE_KIND (x) == REG_UNUSED)
|
|
|
|
|
reg_weight--;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
}
|
|
|
|
|
|
1999-10-11 01:45:27 +02:00
|
|
|
|
INSN_REG_WEIGHT (insn) = reg_weight;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1999-09-06 23:55:23 +02:00
|
|
|
|
/* Scheduling clock, modified in schedule_block() and queue_to_ready (). */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
static int clock_var;
|
|
|
|
|
|
|
|
|
|
/* Move insns that became ready to fire from queue to ready list. */
|
|
|
|
|
|
2000-11-24 18:36:47 +01:00
|
|
|
|
static void
|
|
|
|
|
queue_to_ready (ready)
|
|
|
|
|
struct ready_list *ready;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
{
|
|
|
|
|
rtx insn;
|
|
|
|
|
rtx link;
|
|
|
|
|
|
|
|
|
|
q_ptr = NEXT_Q (q_ptr);
|
|
|
|
|
|
|
|
|
|
/* Add all pending insns that can be scheduled without stalls to the
|
2000-12-03 20:00:00 +01:00
|
|
|
|
ready list. */
|
|
|
|
|
for (link = insn_queue[q_ptr]; link; link = XEXP (link, 1))
|
|
|
|
|
{
|
|
|
|
|
insn = XEXP (link, 0);
|
|
|
|
|
q_size -= 1;
|
2000-12-03 13:53:49 +01:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
if (sched_verbose >= 2)
|
|
|
|
|
fprintf (sched_dump, ";;\t\tQ-->Ready: insn %s: ",
|
|
|
|
|
(*current_sched_info->print_insn) (insn, 0));
|
2000-12-03 13:53:49 +01:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
ready_add (ready, insn);
|
|
|
|
|
if (sched_verbose >= 2)
|
|
|
|
|
fprintf (sched_dump, "moving to ready without stalls\n");
|
2000-12-03 13:53:49 +01:00
|
|
|
|
}
|
2000-12-03 20:00:00 +01:00
|
|
|
|
insn_queue[q_ptr] = 0;
|
|
|
|
|
|
|
|
|
|
/* If there are no ready insns, stall until one is ready and add all
|
|
|
|
|
of the pending insns at that point to the ready list. */
|
|
|
|
|
if (ready->n_ready == 0)
|
2000-12-03 13:53:49 +01:00
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
int stalls;
|
2000-12-03 13:53:49 +01:00
|
|
|
|
|
2002-04-30 00:34:36 +02:00
|
|
|
|
for (stalls = 1; stalls <= MAX_INSN_QUEUE_INDEX; stalls++)
|
2000-12-03 20:00:00 +01:00
|
|
|
|
{
|
|
|
|
|
if ((link = insn_queue[NEXT_Q_AFTER (q_ptr, stalls)]))
|
|
|
|
|
{
|
|
|
|
|
for (; link; link = XEXP (link, 1))
|
|
|
|
|
{
|
|
|
|
|
insn = XEXP (link, 0);
|
|
|
|
|
q_size -= 1;
|
2000-12-03 13:53:49 +01:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
if (sched_verbose >= 2)
|
|
|
|
|
fprintf (sched_dump, ";;\t\tQ-->Ready: insn %s: ",
|
|
|
|
|
(*current_sched_info->print_insn) (insn, 0));
|
2000-12-03 13:53:49 +01:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
ready_add (ready, insn);
|
|
|
|
|
if (sched_verbose >= 2)
|
|
|
|
|
fprintf (sched_dump, "moving to ready with %d stalls\n", stalls);
|
|
|
|
|
}
|
|
|
|
|
insn_queue[NEXT_Q_AFTER (q_ptr, stalls)] = 0;
|
2000-12-03 13:53:49 +01:00
|
|
|
|
|
2002-04-30 00:34:36 +02:00
|
|
|
|
advance_one_cycle ();
|
|
|
|
|
|
|
|
|
|
break;
|
2000-12-03 20:00:00 +01:00
|
|
|
|
}
|
2002-04-30 00:34:36 +02:00
|
|
|
|
|
|
|
|
|
advance_one_cycle ();
|
2000-12-03 20:00:00 +01:00
|
|
|
|
}
|
2000-12-03 13:53:49 +01:00
|
|
|
|
|
2002-04-30 00:34:36 +02:00
|
|
|
|
if ((!targetm.sched.use_dfa_pipeline_interface
|
|
|
|
|
|| !(*targetm.sched.use_dfa_pipeline_interface) ())
|
|
|
|
|
&& sched_verbose && stalls)
|
2000-12-03 20:00:00 +01:00
|
|
|
|
visualize_stall_cycles (stalls);
|
2002-04-30 00:34:36 +02:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
q_ptr = NEXT_Q_AFTER (q_ptr, stalls);
|
|
|
|
|
clock_var += stalls;
|
2000-12-03 13:53:49 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
/* Print the ready list for debugging purposes. Callable from debugger. */
|
2000-12-03 13:53:49 +01:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
static void
|
|
|
|
|
debug_ready_list (ready)
|
|
|
|
|
struct ready_list *ready;
|
2000-12-03 13:53:49 +01:00
|
|
|
|
{
|
2000-12-03 20:00:00 +01:00
|
|
|
|
rtx *p;
|
|
|
|
|
int i;
|
2000-12-03 13:53:49 +01:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
if (ready->n_ready == 0)
|
2002-04-30 00:34:36 +02:00
|
|
|
|
{
|
|
|
|
|
fprintf (sched_dump, "\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2000-12-03 13:53:49 +01:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
p = ready_lastpos (ready);
|
|
|
|
|
for (i = 0; i < ready->n_ready; i++)
|
|
|
|
|
fprintf (sched_dump, " %s", (*current_sched_info->print_insn) (p[i], 0));
|
|
|
|
|
fprintf (sched_dump, "\n");
|
|
|
|
|
}
|
2000-12-03 13:53:49 +01:00
|
|
|
|
|
1999-09-06 23:55:23 +02:00
|
|
|
|
/* move_insn1: Remove INSN from insn chain, and link it after LAST insn. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
|
|
|
|
static rtx
|
|
|
|
|
move_insn1 (insn, last)
|
|
|
|
|
rtx insn, last;
|
|
|
|
|
{
|
|
|
|
|
NEXT_INSN (PREV_INSN (insn)) = NEXT_INSN (insn);
|
|
|
|
|
PREV_INSN (NEXT_INSN (insn)) = PREV_INSN (insn);
|
|
|
|
|
|
|
|
|
|
NEXT_INSN (insn) = NEXT_INSN (last);
|
|
|
|
|
PREV_INSN (NEXT_INSN (last)) = insn;
|
|
|
|
|
|
|
|
|
|
NEXT_INSN (last) = insn;
|
|
|
|
|
PREV_INSN (insn) = last;
|
|
|
|
|
|
|
|
|
|
return insn;
|
|
|
|
|
}
|
|
|
|
|
|
2001-08-07 22:24:08 +02:00
|
|
|
|
/* Search INSN for REG_SAVE_NOTE note pairs for
|
1997-08-12 06:07:19 +02:00
|
|
|
|
NOTE_INSN_{LOOP,EHREGION}_{BEG,END}; and convert them back into
|
1999-10-11 01:45:27 +02:00
|
|
|
|
NOTEs. The REG_SAVE_NOTE note following first one is contains the
|
|
|
|
|
saved value for NOTE_BLOCK_NUMBER which is useful for
|
1997-08-12 06:07:19 +02:00
|
|
|
|
NOTE_INSN_EH_REGION_{BEG,END} NOTEs. LAST is the last instruction
|
|
|
|
|
output by the instruction scheduler. Return the new value of LAST. */
|
|
|
|
|
|
|
|
|
|
static rtx
|
|
|
|
|
reemit_notes (insn, last)
|
|
|
|
|
rtx insn;
|
|
|
|
|
rtx last;
|
|
|
|
|
{
|
|
|
|
|
rtx note, retval;
|
|
|
|
|
|
|
|
|
|
retval = last;
|
|
|
|
|
for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
|
|
|
|
|
{
|
1999-10-11 01:45:27 +02:00
|
|
|
|
if (REG_NOTE_KIND (note) == REG_SAVE_NOTE)
|
1997-08-12 06:07:19 +02:00
|
|
|
|
{
|
2000-04-21 21:32:10 +02:00
|
|
|
|
enum insn_note note_type = INTVAL (XEXP (note, 0));
|
|
|
|
|
|
2001-08-07 22:24:08 +02:00
|
|
|
|
if (note_type == NOTE_INSN_RANGE_BEG
|
|
|
|
|
|| note_type == NOTE_INSN_RANGE_END)
|
1998-08-31 11:55:31 +02:00
|
|
|
|
{
|
|
|
|
|
last = emit_note_before (note_type, last);
|
|
|
|
|
remove_note (insn, note);
|
|
|
|
|
note = XEXP (note, 1);
|
|
|
|
|
NOTE_RANGE_INFO (last) = XEXP (note, 0);
|
|
|
|
|
}
|
1997-08-12 06:07:19 +02:00
|
|
|
|
else
|
|
|
|
|
{
|
1999-07-23 03:26:40 +02:00
|
|
|
|
last = emit_note_before (note_type, last);
|
1999-09-16 23:00:21 +02:00
|
|
|
|
remove_note (insn, note);
|
|
|
|
|
note = XEXP (note, 1);
|
1999-09-16 01:05:05 +02:00
|
|
|
|
if (note_type == NOTE_INSN_EH_REGION_BEG
|
|
|
|
|
|| note_type == NOTE_INSN_EH_REGION_END)
|
1999-09-16 23:00:21 +02:00
|
|
|
|
NOTE_EH_HANDLER (last) = INTVAL (XEXP (note, 0));
|
1997-08-12 06:07:19 +02:00
|
|
|
|
}
|
|
|
|
|
remove_note (insn, note);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return retval;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Move INSN, and all insns which should be issued before it,
|
1997-09-02 06:12:45 +02:00
|
|
|
|
due to SCHED_GROUP_P flag. Reemit notes if needed.
|
|
|
|
|
|
|
|
|
|
Return the last insn emitted by the scheduler, which is the
|
|
|
|
|
return value from the first call to reemit_notes. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
|
|
|
|
static rtx
|
|
|
|
|
move_insn (insn, last)
|
|
|
|
|
rtx insn, last;
|
|
|
|
|
{
|
1997-09-02 06:12:45 +02:00
|
|
|
|
rtx retval = NULL;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
1997-09-02 06:12:45 +02:00
|
|
|
|
/* If INSN has SCHED_GROUP_P set, then issue it and any other
|
|
|
|
|
insns with SCHED_GROUP_P set first. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
while (SCHED_GROUP_P (insn))
|
|
|
|
|
{
|
|
|
|
|
rtx prev = PREV_INSN (insn);
|
1997-09-02 06:12:45 +02:00
|
|
|
|
|
|
|
|
|
/* Move a SCHED_GROUP_P insn. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
move_insn1 (insn, last);
|
1997-09-02 06:12:45 +02:00
|
|
|
|
/* If this is the first call to reemit_notes, then record
|
|
|
|
|
its return value. */
|
|
|
|
|
if (retval == NULL_RTX)
|
|
|
|
|
retval = reemit_notes (insn, insn);
|
|
|
|
|
else
|
|
|
|
|
reemit_notes (insn, insn);
|
1997-08-12 06:07:19 +02:00
|
|
|
|
insn = prev;
|
|
|
|
|
}
|
|
|
|
|
|
1997-09-02 06:12:45 +02:00
|
|
|
|
/* Now move the first non SCHED_GROUP_P insn. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
move_insn1 (insn, last);
|
1997-09-02 06:12:45 +02:00
|
|
|
|
|
|
|
|
|
/* If this is the first call to reemit_notes, then record
|
|
|
|
|
its return value. */
|
|
|
|
|
if (retval == NULL_RTX)
|
|
|
|
|
retval = reemit_notes (insn, insn);
|
|
|
|
|
else
|
|
|
|
|
reemit_notes (insn, insn);
|
|
|
|
|
|
|
|
|
|
return retval;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
}
|
|
|
|
|
|
2002-04-30 00:34:36 +02:00
|
|
|
|
/* The following function returns maximal (or close to maximal) number
|
|
|
|
|
of insns which can be issued on the same cycle and one of which
|
|
|
|
|
insns is insns with the best rank (the last insn in READY). To
|
|
|
|
|
make this function tries different samples of ready insns. READY
|
|
|
|
|
is current queue `ready'. Global array READY_TRY reflects what
|
|
|
|
|
insns are already issued in this try. STATE is current processor
|
|
|
|
|
state. If the function returns nonzero, INDEX will contain index
|
|
|
|
|
of the best insn in READY. The following function is used only for
|
|
|
|
|
first cycle multipass scheduling. */
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
max_issue (ready, state, index)
|
|
|
|
|
struct ready_list *ready;
|
|
|
|
|
state_t state;
|
|
|
|
|
int *index;
|
|
|
|
|
{
|
|
|
|
|
int i, best, n, temp_index, delay;
|
|
|
|
|
state_t temp_state;
|
|
|
|
|
rtx insn;
|
|
|
|
|
int max_lookahead = (*targetm.sched.first_cycle_multipass_dfa_lookahead) ();
|
|
|
|
|
|
|
|
|
|
if (state_dead_lock_p (state))
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
temp_state = alloca (dfa_state_size);
|
|
|
|
|
best = 0;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < ready->n_ready; i++)
|
|
|
|
|
if (!ready_try [i])
|
|
|
|
|
{
|
|
|
|
|
insn = ready_element (ready, i);
|
|
|
|
|
|
|
|
|
|
if (INSN_CODE (insn) < 0)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
memcpy (temp_state, state, dfa_state_size);
|
|
|
|
|
|
|
|
|
|
delay = state_transition (temp_state, insn);
|
|
|
|
|
|
|
|
|
|
if (delay == 0)
|
|
|
|
|
{
|
|
|
|
|
if (!targetm.sched.dfa_bubble)
|
|
|
|
|
continue;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int j;
|
|
|
|
|
rtx bubble;
|
|
|
|
|
|
|
|
|
|
for (j = 0;
|
|
|
|
|
(bubble = (*targetm.sched.dfa_bubble) (j)) != NULL_RTX;
|
|
|
|
|
j++)
|
|
|
|
|
if (state_transition (temp_state, bubble) < 0
|
|
|
|
|
&& state_transition (temp_state, insn) < 0)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if (bubble == NULL_RTX)
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (delay > 0)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
--max_lookahead;
|
|
|
|
|
|
|
|
|
|
if (max_lookahead < 0)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
ready_try [i] = 1;
|
|
|
|
|
|
|
|
|
|
n = max_issue (ready, temp_state, &temp_index);
|
|
|
|
|
if (n > 0 || ready_try[0])
|
|
|
|
|
n += 1;
|
|
|
|
|
|
|
|
|
|
if (best < n)
|
|
|
|
|
{
|
|
|
|
|
best = n;
|
|
|
|
|
*index = i;
|
|
|
|
|
}
|
|
|
|
|
ready_try [i] = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return best;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* The following function chooses insn from READY and modifies
|
|
|
|
|
*N_READY and READY. The following function is used only for first
|
|
|
|
|
cycle multipass scheduling. */
|
|
|
|
|
|
|
|
|
|
static rtx
|
|
|
|
|
choose_ready (ready)
|
|
|
|
|
struct ready_list *ready;
|
|
|
|
|
{
|
|
|
|
|
if (!targetm.sched.first_cycle_multipass_dfa_lookahead
|
|
|
|
|
|| (*targetm.sched.first_cycle_multipass_dfa_lookahead) () <= 0)
|
|
|
|
|
return ready_remove_first (ready);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Try to choose the better insn. */
|
|
|
|
|
int index;
|
|
|
|
|
|
|
|
|
|
if (max_issue (ready, curr_state, &index) == 0)
|
|
|
|
|
return ready_remove_first (ready);
|
|
|
|
|
else
|
|
|
|
|
return ready_remove (ready, index);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-02-28 19:32:12 +01:00
|
|
|
|
/* Called from backends from targetm.sched.reorder to emit stuff into
|
|
|
|
|
the instruction stream. */
|
|
|
|
|
|
|
|
|
|
rtx
|
|
|
|
|
sched_emit_insn (pat)
|
|
|
|
|
rtx pat;
|
|
|
|
|
{
|
|
|
|
|
rtx insn = emit_insn_after (pat, last_scheduled_insn);
|
|
|
|
|
last_scheduled_insn = insn;
|
|
|
|
|
return insn;
|
|
|
|
|
}
|
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
/* Use forward list scheduling to rearrange insns of block B in region RGN,
|
2000-12-03 13:53:49 +01:00
|
|
|
|
possibly bringing insns from subsequent blocks in the same region. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
void
|
|
|
|
|
schedule_block (b, rgn_n_insns)
|
|
|
|
|
int b;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
int rgn_n_insns;
|
|
|
|
|
{
|
2000-11-24 18:36:47 +01:00
|
|
|
|
struct ready_list ready;
|
2002-04-30 00:34:36 +02:00
|
|
|
|
int first_cycle_insn_p;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
int can_issue_more;
|
2002-04-30 00:34:36 +02:00
|
|
|
|
state_t temp_state = NULL; /* It is used for multipass scheduling. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
1999-09-06 23:55:23 +02:00
|
|
|
|
/* Head/tail info for this block. */
|
2000-12-03 13:53:49 +01:00
|
|
|
|
rtx prev_head = current_sched_info->prev_head;
|
|
|
|
|
rtx next_tail = current_sched_info->next_tail;
|
|
|
|
|
rtx head = NEXT_INSN (prev_head);
|
|
|
|
|
rtx tail = PREV_INSN (next_tail);
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
1997-08-25 21:15:01 +02:00
|
|
|
|
/* We used to have code to avoid getting parameters moved from hard
|
|
|
|
|
argument registers into pseudos.
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
1997-08-25 21:15:01 +02:00
|
|
|
|
However, it was removed when it proved to be of marginal benefit
|
|
|
|
|
and caused problems because schedule_block and compute_forward_dependences
|
|
|
|
|
had different notions of what the "head" insn was. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-08-04 22:28:08 +02:00
|
|
|
|
if (head == tail && (! INSN_P (head)))
|
2000-12-03 13:53:49 +01:00
|
|
|
|
abort ();
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
1999-09-06 23:55:23 +02:00
|
|
|
|
/* Debug info. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
if (sched_verbose)
|
|
|
|
|
{
|
2000-12-02 11:47:42 +01:00
|
|
|
|
fprintf (sched_dump, ";; ======================================================\n");
|
|
|
|
|
fprintf (sched_dump,
|
1997-08-12 06:07:19 +02:00
|
|
|
|
";; -- basic block %d from %d to %d -- %s reload\n",
|
2000-12-19 18:41:20 +01:00
|
|
|
|
b, INSN_UID (head), INSN_UID (tail),
|
1997-08-12 06:07:19 +02:00
|
|
|
|
(reload_completed ? "after" : "before"));
|
2000-12-02 11:47:42 +01:00
|
|
|
|
fprintf (sched_dump, ";; ======================================================\n");
|
|
|
|
|
fprintf (sched_dump, "\n");
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-12-03 15:35:17 +01:00
|
|
|
|
visualize_alloc ();
|
1997-08-12 06:07:19 +02:00
|
|
|
|
init_block_visualization ();
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-30 00:34:36 +02:00
|
|
|
|
if (targetm.sched.use_dfa_pipeline_interface
|
|
|
|
|
&& (*targetm.sched.use_dfa_pipeline_interface) ())
|
|
|
|
|
state_reset (curr_state);
|
|
|
|
|
else
|
|
|
|
|
clear_units ();
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
1999-09-06 23:55:23 +02:00
|
|
|
|
/* Allocate the ready list. */
|
haifa-sched.c: Convert to target hooks.
* 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.
From-SVN: r45009
2001-08-18 22:25:54 +02:00
|
|
|
|
ready.veclen = rgn_n_insns + 1 + issue_rate;
|
2000-11-24 18:36:47 +01:00
|
|
|
|
ready.first = ready.veclen - 1;
|
|
|
|
|
ready.vec = (rtx *) xmalloc (ready.veclen * sizeof (rtx));
|
|
|
|
|
ready.n_ready = 0;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2002-04-30 00:34:36 +02:00
|
|
|
|
if (targetm.sched.use_dfa_pipeline_interface
|
|
|
|
|
&& (*targetm.sched.use_dfa_pipeline_interface) ())
|
|
|
|
|
{
|
|
|
|
|
/* It is used for first cycle multipass scheduling. */
|
|
|
|
|
temp_state = alloca (dfa_state_size);
|
|
|
|
|
ready_try = (char *) xmalloc ((rgn_n_insns + 1) * sizeof (char));
|
|
|
|
|
memset (ready_try, 0, (rgn_n_insns + 1) * sizeof (char));
|
|
|
|
|
}
|
|
|
|
|
|
2000-12-03 13:53:49 +01:00
|
|
|
|
(*current_sched_info->init_ready_list) (&ready);
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
haifa-sched.c: Convert to target hooks.
* 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.
From-SVN: r45009
2001-08-18 22:25:54 +02:00
|
|
|
|
if (targetm.sched.md_init)
|
|
|
|
|
(*targetm.sched.md_init) (sched_dump, sched_verbose, ready.veclen);
|
1998-06-26 15:09:01 +02:00
|
|
|
|
|
2002-02-28 19:32:12 +01:00
|
|
|
|
/* We start inserting insns after PREV_HEAD. */
|
|
|
|
|
last_scheduled_insn = prev_head;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-12-03 13:53:49 +01:00
|
|
|
|
/* Initialize INSN_QUEUE. Q_SIZE is the total number of insns in the
|
|
|
|
|
queue. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
q_ptr = 0;
|
|
|
|
|
q_size = 0;
|
2002-04-30 00:34:36 +02:00
|
|
|
|
|
|
|
|
|
if (!targetm.sched.use_dfa_pipeline_interface
|
|
|
|
|
|| !(*targetm.sched.use_dfa_pipeline_interface) ())
|
|
|
|
|
max_insn_queue_index_macro_value = INSN_QUEUE_SIZE - 1;
|
|
|
|
|
else
|
|
|
|
|
max_insn_queue_index_macro_value = max_insn_queue_index;
|
|
|
|
|
|
|
|
|
|
insn_queue = (rtx *) alloca ((MAX_INSN_QUEUE_INDEX + 1) * sizeof (rtx));
|
|
|
|
|
memset ((char *) insn_queue, 0, (MAX_INSN_QUEUE_INDEX + 1) * sizeof (rtx));
|
|
|
|
|
last_clock_var = -1;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
1999-07-21 03:15:47 +02:00
|
|
|
|
/* Start just before the beginning of time. */
|
|
|
|
|
clock_var = -1;
|
|
|
|
|
|
1999-09-06 23:55:23 +02:00
|
|
|
|
/* Loop until all the insns in BB are scheduled. */
|
2000-12-03 13:53:49 +01:00
|
|
|
|
while ((*current_sched_info->schedule_more_p) ())
|
1997-08-12 06:07:19 +02:00
|
|
|
|
{
|
|
|
|
|
clock_var++;
|
|
|
|
|
|
2002-04-30 00:34:36 +02:00
|
|
|
|
advance_one_cycle ();
|
|
|
|
|
|
1997-08-12 06:07:19 +02:00
|
|
|
|
/* Add to the ready list all pending insns that can be issued now.
|
|
|
|
|
If there are no ready insns, increment clock until one
|
|
|
|
|
is ready and add all pending insns at that point to the ready
|
|
|
|
|
list. */
|
2000-11-24 18:36:47 +01:00
|
|
|
|
queue_to_ready (&ready);
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-11-24 18:36:47 +01:00
|
|
|
|
if (ready.n_ready == 0)
|
1997-08-12 06:07:19 +02:00
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
|
|
if (sched_verbose >= 2)
|
|
|
|
|
{
|
2000-12-02 11:47:42 +01:00
|
|
|
|
fprintf (sched_dump, ";;\t\tReady list after queue_to_ready: ");
|
2000-11-24 18:36:47 +01:00
|
|
|
|
debug_ready_list (&ready);
|
1997-08-12 06:07:19 +02:00
|
|
|
|
}
|
|
|
|
|
|
1999-07-21 03:15:47 +02:00
|
|
|
|
/* Sort the ready list based on priority. */
|
2000-11-24 18:36:47 +01:00
|
|
|
|
ready_sort (&ready);
|
1999-07-21 03:15:47 +02:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
/* Allow the target to reorder the list, typically for
|
|
|
|
|
better instruction bundling. */
|
haifa-sched.c: Convert to target hooks.
* 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.
From-SVN: r45009
2001-08-18 22:25:54 +02:00
|
|
|
|
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;
|
1999-11-29 12:44:57 +01:00
|
|
|
|
|
2002-04-30 00:34:36 +02:00
|
|
|
|
first_cycle_insn_p = 1;
|
|
|
|
|
for (;;)
|
1999-11-29 12:44:57 +01:00
|
|
|
|
{
|
2002-04-30 00:34:36 +02:00
|
|
|
|
rtx insn;
|
|
|
|
|
int cost;
|
|
|
|
|
|
2002-05-03 02:05:52 +02:00
|
|
|
|
if (sched_verbose >= 2)
|
2002-04-30 00:34:36 +02:00
|
|
|
|
{
|
|
|
|
|
fprintf (sched_dump, ";;\tReady list (t =%3d): ",
|
|
|
|
|
clock_var);
|
|
|
|
|
debug_ready_list (&ready);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!targetm.sched.use_dfa_pipeline_interface
|
|
|
|
|
|| !(*targetm.sched.use_dfa_pipeline_interface) ())
|
|
|
|
|
{
|
|
|
|
|
if (ready.n_ready == 0 || !can_issue_more
|
|
|
|
|
|| !(*current_sched_info->schedule_more_p) ())
|
|
|
|
|
break;
|
|
|
|
|
insn = choose_ready (&ready);
|
|
|
|
|
cost = actual_hazard (insn_unit (insn), insn, clock_var, 0);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (ready.n_ready == 0 || !can_issue_more
|
|
|
|
|
|| state_dead_lock_p (curr_state)
|
|
|
|
|
|| !(*current_sched_info->schedule_more_p) ())
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* Select and remove the insn from the ready list. */
|
|
|
|
|
insn = choose_ready (&ready);
|
|
|
|
|
|
|
|
|
|
memcpy (temp_state, curr_state, dfa_state_size);
|
|
|
|
|
if (recog_memoized (insn) < 0)
|
|
|
|
|
{
|
|
|
|
|
if (!first_cycle_insn_p
|
|
|
|
|
&& (GET_CODE (PATTERN (insn)) == ASM_INPUT
|
|
|
|
|
|| asm_noperands (PATTERN (insn)) >= 0))
|
|
|
|
|
/* This is asm insn which is tryed to be issued on the
|
|
|
|
|
cycle not first. Issue it on the next cycle. */
|
|
|
|
|
cost = 1;
|
|
|
|
|
else
|
|
|
|
|
/* A USE insn, or something else we don't need to
|
|
|
|
|
understand. We can't pass these directly to
|
|
|
|
|
state_transition because it will trigger a
|
|
|
|
|
fatal error for unrecognizable insns. */
|
|
|
|
|
cost = 0;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
cost = state_transition (temp_state, insn);
|
|
|
|
|
|
|
|
|
|
if (targetm.sched.first_cycle_multipass_dfa_lookahead
|
|
|
|
|
&& targetm.sched.dfa_bubble)
|
|
|
|
|
{
|
|
|
|
|
if (cost == 0)
|
|
|
|
|
{
|
|
|
|
|
int j;
|
|
|
|
|
rtx bubble;
|
|
|
|
|
|
|
|
|
|
for (j = 0;
|
|
|
|
|
(bubble = (*targetm.sched.dfa_bubble) (j))
|
|
|
|
|
!= NULL_RTX;
|
|
|
|
|
j++)
|
|
|
|
|
{
|
|
|
|
|
memcpy (temp_state, curr_state, dfa_state_size);
|
|
|
|
|
|
|
|
|
|
if (state_transition (temp_state, bubble) < 0
|
|
|
|
|
&& state_transition (temp_state, insn) < 0)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bubble != NULL_RTX)
|
|
|
|
|
{
|
|
|
|
|
if (insert_schedule_bubbles_p)
|
|
|
|
|
{
|
|
|
|
|
rtx copy;
|
|
|
|
|
|
|
|
|
|
copy = copy_rtx (PATTERN (bubble));
|
|
|
|
|
emit_insn_after (copy, last_scheduled_insn);
|
|
|
|
|
last_scheduled_insn
|
|
|
|
|
= NEXT_INSN (last_scheduled_insn);
|
|
|
|
|
INSN_CODE (last_scheduled_insn)
|
|
|
|
|
= INSN_CODE (bubble);
|
|
|
|
|
|
|
|
|
|
/* Annotate the same for the first insns
|
|
|
|
|
scheduling by using mode. */
|
|
|
|
|
PUT_MODE (last_scheduled_insn,
|
|
|
|
|
(clock_var > last_clock_var
|
|
|
|
|
? clock_var - last_clock_var
|
|
|
|
|
: VOIDmode));
|
|
|
|
|
last_clock_var = clock_var;
|
|
|
|
|
|
|
|
|
|
if (sched_verbose >= 2)
|
|
|
|
|
{
|
|
|
|
|
fprintf (sched_dump,
|
|
|
|
|
";;\t\t--> scheduling bubble insn <<<%d>>>:reservation ",
|
|
|
|
|
INSN_UID (last_scheduled_insn));
|
|
|
|
|
|
|
|
|
|
if (recog_memoized (last_scheduled_insn)
|
|
|
|
|
< 0)
|
|
|
|
|
fprintf (sched_dump, "nothing");
|
|
|
|
|
else
|
|
|
|
|
print_reservation
|
|
|
|
|
(sched_dump, last_scheduled_insn);
|
|
|
|
|
|
|
|
|
|
fprintf (sched_dump, "\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
cost = -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (cost < 0)
|
|
|
|
|
cost = 0;
|
|
|
|
|
else if (cost == 0)
|
|
|
|
|
cost = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
1999-11-29 12:44:57 +01:00
|
|
|
|
|
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
if (cost >= 1)
|
|
|
|
|
{
|
|
|
|
|
queue_insn (insn, cost);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
1999-11-29 12:44:57 +01:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
if (! (*current_sched_info->can_schedule_ready_p) (insn))
|
|
|
|
|
goto next;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2002-02-28 19:32:12 +01:00
|
|
|
|
last_scheduled_insn = move_insn (insn, last_scheduled_insn);
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2002-04-30 00:34:36 +02:00
|
|
|
|
if (targetm.sched.use_dfa_pipeline_interface
|
|
|
|
|
&& (*targetm.sched.use_dfa_pipeline_interface) ())
|
|
|
|
|
memcpy (curr_state, temp_state, dfa_state_size);
|
|
|
|
|
|
haifa-sched.c: Convert to target hooks.
* 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.
From-SVN: r45009
2001-08-18 22:25:54 +02:00
|
|
|
|
if (targetm.sched.variable_issue)
|
|
|
|
|
can_issue_more =
|
|
|
|
|
(*targetm.sched.variable_issue) (sched_dump, sched_verbose,
|
|
|
|
|
insn, can_issue_more);
|
|
|
|
|
else
|
|
|
|
|
can_issue_more--;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
schedule_insn (insn, &ready, clock_var);
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
next:
|
2002-04-30 00:34:36 +02:00
|
|
|
|
first_cycle_insn_p = 0;
|
|
|
|
|
|
haifa-sched.c: Convert to target hooks.
* 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.
From-SVN: r45009
2001-08-18 22:25:54 +02:00
|
|
|
|
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);
|
|
|
|
|
}
|
2000-12-03 20:00:00 +01:00
|
|
|
|
}
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2002-04-30 00:34:36 +02:00
|
|
|
|
if ((!targetm.sched.use_dfa_pipeline_interface
|
|
|
|
|
|| !(*targetm.sched.use_dfa_pipeline_interface) ())
|
|
|
|
|
&& sched_verbose)
|
|
|
|
|
/* Debug info. */
|
2000-12-03 20:00:00 +01:00
|
|
|
|
visualize_scheduled_insns (clock_var);
|
|
|
|
|
}
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
haifa-sched.c: Convert to target hooks.
* 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.
From-SVN: r45009
2001-08-18 22:25:54 +02:00
|
|
|
|
if (targetm.sched.md_finish)
|
|
|
|
|
(*targetm.sched.md_finish) (sched_dump, sched_verbose);
|
2000-12-19 18:41:20 +01:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
/* Debug info. */
|
|
|
|
|
if (sched_verbose)
|
|
|
|
|
{
|
|
|
|
|
fprintf (sched_dump, ";;\tReady list (final): ");
|
|
|
|
|
debug_ready_list (&ready);
|
2002-04-30 00:34:36 +02:00
|
|
|
|
if (!targetm.sched.use_dfa_pipeline_interface
|
|
|
|
|
|| !(*targetm.sched.use_dfa_pipeline_interface) ())
|
|
|
|
|
print_block_visualization ("");
|
2000-12-03 20:00:00 +01:00
|
|
|
|
}
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
/* Sanity check -- queue must be empty now. Meaningless if region has
|
|
|
|
|
multiple bbs. */
|
|
|
|
|
if (current_sched_info->queue_must_finish_empty && q_size != 0)
|
|
|
|
|
abort ();
|
1998-03-05 03:15:23 +01:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
/* Update head/tail boundaries. */
|
|
|
|
|
head = NEXT_INSN (prev_head);
|
2002-02-28 19:32:12 +01:00
|
|
|
|
tail = last_scheduled_insn;
|
1998-03-05 03:15:23 +01:00
|
|
|
|
|
cfglayout.c (scope_def, [...]): Remove.
* cfglayout.c (scope_def, scope_forest_info, forest,
relate_bbs_with_scopes, make_new_scope, build_scope_forest,
remove_scope_notes, insert_intra_before_1, insert_intra_1,
insert_intra_bb_scope_notes, insert_inter_bb_scope_notes,
rebuild_scope_notes, free_scope_forest_1, dump_scope_forest,
dump_scope_forest_1, get_next_bb_note, get_prev_bb_note): Remove.
(fixup_reorder_chain): Don't set scope for bb.
(insn_scopes, scope_to_insns_initialize, set_block_levels,
change_scope, scope_to_insns_finalize): New.
(cfg_layout_initialize, cfg_layout_finalize): Update to match.
* cfglayout.h (scope_def, scope): Remove.
(reorder_block_def): Remove scope member.
(scope_to_insns_initialize, scope_to_insns_finalize): Declare.
* haifa-sched.c: Revert reemit_other_notes change.
* sched-ebb.c (schedule_ebbs): Don't call remove_unnecessary_notes.
Use scope_to_insns_initialize and scope_to_insns_finalize.
* sched-rgn.c (schedule_insns): Likewise.
* gcc.dg/debug-6.c: New.
From-SVN: r48412
2001-12-31 05:19:35 +01:00
|
|
|
|
/* Restore-other-notes: NOTE_LIST is the end of a chain of notes
|
|
|
|
|
previously found among the insns. Insert them at the beginning
|
|
|
|
|
of the insns. */
|
|
|
|
|
if (note_list != 0)
|
|
|
|
|
{
|
|
|
|
|
rtx note_head = note_list;
|
|
|
|
|
|
|
|
|
|
while (PREV_INSN (note_head))
|
|
|
|
|
{
|
|
|
|
|
note_head = PREV_INSN (note_head);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PREV_INSN (note_head) = PREV_INSN (head);
|
|
|
|
|
NEXT_INSN (PREV_INSN (head)) = note_head;
|
|
|
|
|
PREV_INSN (head) = note_list;
|
|
|
|
|
NEXT_INSN (note_list) = head;
|
|
|
|
|
head = note_head;
|
|
|
|
|
}
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
/* Debugging. */
|
|
|
|
|
if (sched_verbose)
|
1997-08-12 06:07:19 +02:00
|
|
|
|
{
|
2000-12-03 20:00:00 +01:00
|
|
|
|
fprintf (sched_dump, ";; total time = %d\n;; new head = %d\n",
|
|
|
|
|
clock_var, INSN_UID (head));
|
|
|
|
|
fprintf (sched_dump, ";; new tail = %d\n\n",
|
|
|
|
|
INSN_UID (tail));
|
|
|
|
|
visualize_free ();
|
|
|
|
|
}
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
current_sched_info->head = head;
|
|
|
|
|
current_sched_info->tail = tail;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
free (ready.vec);
|
2002-04-30 00:34:36 +02:00
|
|
|
|
|
|
|
|
|
if (targetm.sched.use_dfa_pipeline_interface
|
|
|
|
|
&& (*targetm.sched.use_dfa_pipeline_interface) ())
|
|
|
|
|
free (ready_try);
|
1997-08-12 06:07:19 +02:00
|
|
|
|
}
|
2000-12-03 20:00:00 +01:00
|
|
|
|
|
1999-09-06 23:55:23 +02:00
|
|
|
|
/* Set_priorities: compute priority of each insn in the block. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
int
|
2000-12-19 18:41:20 +01:00
|
|
|
|
set_priorities (head, tail)
|
|
|
|
|
rtx head, tail;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
{
|
|
|
|
|
rtx insn;
|
|
|
|
|
int n_insn;
|
|
|
|
|
|
|
|
|
|
rtx prev_head;
|
|
|
|
|
|
|
|
|
|
prev_head = PREV_INSN (head);
|
|
|
|
|
|
2000-08-04 22:28:08 +02:00
|
|
|
|
if (head == tail && (! INSN_P (head)))
|
1997-08-12 06:07:19 +02:00
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
n_insn = 0;
|
|
|
|
|
for (insn = tail; insn != prev_head; insn = PREV_INSN (insn))
|
|
|
|
|
{
|
|
|
|
|
if (GET_CODE (insn) == NOTE)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (!(SCHED_GROUP_P (insn)))
|
|
|
|
|
n_insn++;
|
|
|
|
|
(void) priority (insn);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return n_insn;
|
|
|
|
|
}
|
|
|
|
|
|
2000-12-02 11:47:42 +01:00
|
|
|
|
/* Initialize some global state for the scheduler. DUMP_FILE is to be used
|
|
|
|
|
for debugging output. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
void
|
2000-12-02 11:47:42 +01:00
|
|
|
|
sched_init (dump_file)
|
1997-08-12 06:07:19 +02:00
|
|
|
|
FILE *dump_file;
|
|
|
|
|
{
|
bb-reorder.c (make_reorder_chain, [...]): Use FOR_EACH_BB macros to iterate over basic block chain.
* bb-reorder.c (make_reorder_chain, make_reorder_chain_1):
Use FOR_EACH_BB macros to iterate over basic block chain.
* cfg.c (clear_edges, clear_bb_flags, dump_flow_info,
alloc_aux_for_blocks, clear_aux_for_blocks, alloc_aux_for_edges):
Likewise.
* cfganal.c (set_edge_can_fallthru_flag, flow_call_edges_add,
find_unreachable_blocks, create_edge_list, verify_edge_list,
remove_fake_edges, add_noreturn_fake_exit_edges,
flow_preorder_transversal_compute, flow_dfs_compute_reverse_execute):
Likewise.
* cfgbuild.c (make_edges, find_basic_blocks, find_many_sub_basic_blocks,
find_sub_basic_blocks): Likewise.
* cfgcleanup.c (try_optimize_cfg, delete_unreachable_blocks):
Likewise.
* cfglayout.c (record_effective_endpoints, cleanup_unconditional_jumps):
Likewise.
* cfgloop.c (flow_loops_cfg_dump, flow_loops_find):
Likewise.
* cfgrtl.c (compute_bb_for_insn, tidy_fallthru_edges,
commit_edge_insertions, commit_edge_insertions_watch_calls,
print_rtl_with_bb, verify_flow_info, purge_all_dead_edges): Likewise.
* combine.c (combine_instructions, reg_dead_at_p): Likewise.
* conflict.c (conflict_graph_compute): Likewise.
* df.c (df_bitmaps_alloc, df_bitmaps_free, df_alloc, df_analyse_1,
df_modified_p, df_refs_unlink, df_dump): Likewise.
* dominance.c (calc_dfs_tree, calculate_dominance_info): Likewise.
* final.c (compute_alignments): Likewise.
* flow.c (update_life_info, update_life_info_in_dirty_blocks,
delete_noop_moves, calculate_global_regs_live, allocate_bb_life_data,
count_or_remove_death_notes): Likewise.
* gcse.c (oprs_unchanged_p, record_last_reg_set_info,
compute_hash_table, compute_kill_rd, compute_rd, compute_ae_kill,
classic_gcse, compute_transp, cprop, compute_pre_data,
compute_transpout, invalidate_nonnull_info,
delete_null_pointer_checks_1, delete_null_pointer_checks,
compute_code_hoist_vbeinout, hoist_code, compute_ld_motion_mems,
compute_store_table, build_store_vectors, store_motion): Likewise.
* global.c (global_conflicts, mark_elimination): Likewise.
* graph.c (print_rtl_graph_with_bb): Likewise.
* haifa-sched.c (sched_init): Likewise.
* ifcvt.c (if_convert): Likewise.
* lcm.c (compute_antinout_edge, compute_laterin, compute_insert_delete,
compute_available, compute_nearerout, compute_rev_insert_delete,
optimize_mode_switching): Likewise.
* local-alloc.c (local_alloc, update_equiv_regs): Likewise.
* predict.c (estimate_probability, note_prediction_to_br_prob,
propagate_freq, counts_to_freqs, expensive_function_p,
estimate_bb_frequencies): Likewise.
* profile.c (instrument_edges, get_exec_counts,
compute_branch_probabilities, compute_checksum, branch_prob,
find_spanning_tree): Likewise.
* recog.c (split_all_insns, peephole2_optimize): Likewise.
* reg-stack.c (reg_to_stack, convert_regs_entry, convert_regs):
Likewise.
* regclass.c (scan_one_insn, regclass): Likewise.
* regmove.c (mark_flags_life_zones, regmove_optimize,
record_stack_memrefs): Likewise.
* regrename.c (regrename_optimize, copyprop_hardreg_forward): Likewise.
* reload1.c (reload, reload_combine, fixup_abnormal_edges): Likewise.
* resource.c (find_basic_block): Likewise.
* sched-ebb.c (schedule_ebbs): Likewise.
* sched-rgn.c (is_cfg_nonregular, build_control_flow,
find_single_block_region, find_rgns, schedule_insns)
* sibcall.c (optimize_sibling_and_tail_recursive_call)
* ssa-ccp.c (optimize_unexecutable_edges,
ssa_ccp_df_delete_unreachable_insns): Likewise.
* ssa-dce.c (ssa_eliminate_dead_code): Likewise.
* ssa.c (find_evaluations, compute_dominance_frontiers_1,
rename_block, convert_to_ssa, compute_conservative_reg_partition,
compute_coalesced_reg_partition, rename_equivalent_regs,
convert_from_ssa): Likewise.
* config/ia64/ia64.c (emit_predicate_relation_info, process_epilogue,
process_for_unwind_directive): Likewise.
* df.c (FOR_ALL_BBS): Removed.
* gcse.c (struct null_pointer_info): Type of current_block field
changed.
(struct reg_avail_info): Type of last_bb field changed.
* config/ia64/ia64.c (block_num): Removed.
(need_copy_state): Type changed.
(last_block): New.
From-SVN: r53804
2002-05-23 21:23:51 +02:00
|
|
|
|
int luid;
|
|
|
|
|
basic_block b;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
rtx insn;
|
2002-04-30 00:34:36 +02:00
|
|
|
|
int i;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
1999-09-06 23:55:23 +02:00
|
|
|
|
/* Disable speculative loads in their presence if cc0 defined. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
#ifdef HAVE_cc0
|
|
|
|
|
flag_schedule_speculative_load = 0;
|
|
|
|
|
#endif
|
|
|
|
|
|
1999-09-06 23:55:23 +02:00
|
|
|
|
/* Set dump and sched_verbose for the desired debugging output. If no
|
2000-04-16 00:27:59 +02:00
|
|
|
|
dump-file was specified, but -fsched-verbose=N (any N), print to stderr.
|
|
|
|
|
For -fsched-verbose=N, N>=10, print everything to stderr. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
sched_verbose = sched_verbose_param;
|
|
|
|
|
if (sched_verbose_param == 0 && dump_file)
|
|
|
|
|
sched_verbose = 1;
|
2000-12-02 11:47:42 +01:00
|
|
|
|
sched_dump = ((sched_verbose_param >= 10 || !dump_file)
|
|
|
|
|
? stderr : dump_file);
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
1999-09-06 23:55:23 +02:00
|
|
|
|
/* Initialize issue_rate. */
|
haifa-sched.c: Convert to target hooks.
* 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.
From-SVN: r45009
2001-08-18 22:25:54 +02:00
|
|
|
|
if (targetm.sched.issue_rate)
|
|
|
|
|
issue_rate = (*targetm.sched.issue_rate) ();
|
|
|
|
|
else
|
|
|
|
|
issue_rate = 1;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
1999-10-19 00:20:27 +02:00
|
|
|
|
/* We use LUID 0 for the fake insn (UID 0) which holds dependencies for
|
|
|
|
|
pseudos which do not cross calls. */
|
2000-12-02 11:47:42 +01:00
|
|
|
|
old_max_uid = get_max_uid () + 1;
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-12-02 11:47:42 +01:00
|
|
|
|
h_i_d = (struct haifa_insn_data *) xcalloc (old_max_uid, sizeof (*h_i_d));
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2002-04-30 00:34:36 +02:00
|
|
|
|
for (i = 0; i < old_max_uid; i++)
|
|
|
|
|
h_i_d [i].cost = -1;
|
|
|
|
|
|
|
|
|
|
if (targetm.sched.use_dfa_pipeline_interface
|
|
|
|
|
&& (*targetm.sched.use_dfa_pipeline_interface) ())
|
|
|
|
|
{
|
|
|
|
|
if (targetm.sched.init_dfa_pre_cycle_insn)
|
|
|
|
|
(*targetm.sched.init_dfa_pre_cycle_insn) ();
|
|
|
|
|
|
|
|
|
|
if (targetm.sched.init_dfa_post_cycle_insn)
|
|
|
|
|
(*targetm.sched.init_dfa_post_cycle_insn) ();
|
|
|
|
|
|
|
|
|
|
if (targetm.sched.first_cycle_multipass_dfa_lookahead
|
|
|
|
|
&& targetm.sched.init_dfa_bubbles)
|
|
|
|
|
(*targetm.sched.init_dfa_bubbles) ();
|
|
|
|
|
|
|
|
|
|
dfa_start ();
|
|
|
|
|
dfa_state_size = state_size ();
|
|
|
|
|
curr_state = xmalloc (dfa_state_size);
|
|
|
|
|
}
|
|
|
|
|
|
haifa-sched.c (struct haifa_insn_data, h_i_d): New.
* haifa-sched.c (struct haifa_insn_data, h_i_d): New.
(insn_luid, insn_priority, insn_costs, insn_units): Remove.
(insn_reg_weight, insn_depend, insn_dep_count): Remove.
(insn_blockage, insn_ref_count, line_note, insn_tick): Remove.
(cant_move, fed_by_spec_load, is_load_insn): Remove.
(schedule_region): Remove unused variable.
(schedule_insns): Allocate h_i_d, and not all the separate arrays.
From-SVN: r30435
1999-11-06 20:41:37 +01:00
|
|
|
|
h_i_d[0].luid = 0;
|
1999-10-17 08:28:22 +02:00
|
|
|
|
luid = 1;
|
bb-reorder.c (make_reorder_chain, [...]): Use FOR_EACH_BB macros to iterate over basic block chain.
* bb-reorder.c (make_reorder_chain, make_reorder_chain_1):
Use FOR_EACH_BB macros to iterate over basic block chain.
* cfg.c (clear_edges, clear_bb_flags, dump_flow_info,
alloc_aux_for_blocks, clear_aux_for_blocks, alloc_aux_for_edges):
Likewise.
* cfganal.c (set_edge_can_fallthru_flag, flow_call_edges_add,
find_unreachable_blocks, create_edge_list, verify_edge_list,
remove_fake_edges, add_noreturn_fake_exit_edges,
flow_preorder_transversal_compute, flow_dfs_compute_reverse_execute):
Likewise.
* cfgbuild.c (make_edges, find_basic_blocks, find_many_sub_basic_blocks,
find_sub_basic_blocks): Likewise.
* cfgcleanup.c (try_optimize_cfg, delete_unreachable_blocks):
Likewise.
* cfglayout.c (record_effective_endpoints, cleanup_unconditional_jumps):
Likewise.
* cfgloop.c (flow_loops_cfg_dump, flow_loops_find):
Likewise.
* cfgrtl.c (compute_bb_for_insn, tidy_fallthru_edges,
commit_edge_insertions, commit_edge_insertions_watch_calls,
print_rtl_with_bb, verify_flow_info, purge_all_dead_edges): Likewise.
* combine.c (combine_instructions, reg_dead_at_p): Likewise.
* conflict.c (conflict_graph_compute): Likewise.
* df.c (df_bitmaps_alloc, df_bitmaps_free, df_alloc, df_analyse_1,
df_modified_p, df_refs_unlink, df_dump): Likewise.
* dominance.c (calc_dfs_tree, calculate_dominance_info): Likewise.
* final.c (compute_alignments): Likewise.
* flow.c (update_life_info, update_life_info_in_dirty_blocks,
delete_noop_moves, calculate_global_regs_live, allocate_bb_life_data,
count_or_remove_death_notes): Likewise.
* gcse.c (oprs_unchanged_p, record_last_reg_set_info,
compute_hash_table, compute_kill_rd, compute_rd, compute_ae_kill,
classic_gcse, compute_transp, cprop, compute_pre_data,
compute_transpout, invalidate_nonnull_info,
delete_null_pointer_checks_1, delete_null_pointer_checks,
compute_code_hoist_vbeinout, hoist_code, compute_ld_motion_mems,
compute_store_table, build_store_vectors, store_motion): Likewise.
* global.c (global_conflicts, mark_elimination): Likewise.
* graph.c (print_rtl_graph_with_bb): Likewise.
* haifa-sched.c (sched_init): Likewise.
* ifcvt.c (if_convert): Likewise.
* lcm.c (compute_antinout_edge, compute_laterin, compute_insert_delete,
compute_available, compute_nearerout, compute_rev_insert_delete,
optimize_mode_switching): Likewise.
* local-alloc.c (local_alloc, update_equiv_regs): Likewise.
* predict.c (estimate_probability, note_prediction_to_br_prob,
propagate_freq, counts_to_freqs, expensive_function_p,
estimate_bb_frequencies): Likewise.
* profile.c (instrument_edges, get_exec_counts,
compute_branch_probabilities, compute_checksum, branch_prob,
find_spanning_tree): Likewise.
* recog.c (split_all_insns, peephole2_optimize): Likewise.
* reg-stack.c (reg_to_stack, convert_regs_entry, convert_regs):
Likewise.
* regclass.c (scan_one_insn, regclass): Likewise.
* regmove.c (mark_flags_life_zones, regmove_optimize,
record_stack_memrefs): Likewise.
* regrename.c (regrename_optimize, copyprop_hardreg_forward): Likewise.
* reload1.c (reload, reload_combine, fixup_abnormal_edges): Likewise.
* resource.c (find_basic_block): Likewise.
* sched-ebb.c (schedule_ebbs): Likewise.
* sched-rgn.c (is_cfg_nonregular, build_control_flow,
find_single_block_region, find_rgns, schedule_insns)
* sibcall.c (optimize_sibling_and_tail_recursive_call)
* ssa-ccp.c (optimize_unexecutable_edges,
ssa_ccp_df_delete_unreachable_insns): Likewise.
* ssa-dce.c (ssa_eliminate_dead_code): Likewise.
* ssa.c (find_evaluations, compute_dominance_frontiers_1,
rename_block, convert_to_ssa, compute_conservative_reg_partition,
compute_coalesced_reg_partition, rename_equivalent_regs,
convert_from_ssa): Likewise.
* config/ia64/ia64.c (emit_predicate_relation_info, process_epilogue,
process_for_unwind_directive): Likewise.
* df.c (FOR_ALL_BBS): Removed.
* gcse.c (struct null_pointer_info): Type of current_block field
changed.
(struct reg_avail_info): Type of last_bb field changed.
* config/ia64/ia64.c (block_num): Removed.
(need_copy_state): Type changed.
(last_block): New.
From-SVN: r53804
2002-05-23 21:23:51 +02:00
|
|
|
|
FOR_EACH_BB (b)
|
|
|
|
|
for (insn = b->head;; insn = NEXT_INSN (insn))
|
1997-08-12 06:07:19 +02:00
|
|
|
|
{
|
1999-10-25 03:34:16 +02:00
|
|
|
|
INSN_LUID (insn) = luid;
|
|
|
|
|
|
|
|
|
|
/* Increment the next luid, unless this is a note. We don't
|
|
|
|
|
really need separate IDs for notes and we don't want to
|
|
|
|
|
schedule differently depending on whether or not there are
|
|
|
|
|
line-number notes, i.e., depending on whether or not we're
|
|
|
|
|
generating debugging information. */
|
|
|
|
|
if (GET_CODE (insn) != NOTE)
|
|
|
|
|
++luid;
|
|
|
|
|
|
bb-reorder.c (make_reorder_chain, [...]): Use FOR_EACH_BB macros to iterate over basic block chain.
* bb-reorder.c (make_reorder_chain, make_reorder_chain_1):
Use FOR_EACH_BB macros to iterate over basic block chain.
* cfg.c (clear_edges, clear_bb_flags, dump_flow_info,
alloc_aux_for_blocks, clear_aux_for_blocks, alloc_aux_for_edges):
Likewise.
* cfganal.c (set_edge_can_fallthru_flag, flow_call_edges_add,
find_unreachable_blocks, create_edge_list, verify_edge_list,
remove_fake_edges, add_noreturn_fake_exit_edges,
flow_preorder_transversal_compute, flow_dfs_compute_reverse_execute):
Likewise.
* cfgbuild.c (make_edges, find_basic_blocks, find_many_sub_basic_blocks,
find_sub_basic_blocks): Likewise.
* cfgcleanup.c (try_optimize_cfg, delete_unreachable_blocks):
Likewise.
* cfglayout.c (record_effective_endpoints, cleanup_unconditional_jumps):
Likewise.
* cfgloop.c (flow_loops_cfg_dump, flow_loops_find):
Likewise.
* cfgrtl.c (compute_bb_for_insn, tidy_fallthru_edges,
commit_edge_insertions, commit_edge_insertions_watch_calls,
print_rtl_with_bb, verify_flow_info, purge_all_dead_edges): Likewise.
* combine.c (combine_instructions, reg_dead_at_p): Likewise.
* conflict.c (conflict_graph_compute): Likewise.
* df.c (df_bitmaps_alloc, df_bitmaps_free, df_alloc, df_analyse_1,
df_modified_p, df_refs_unlink, df_dump): Likewise.
* dominance.c (calc_dfs_tree, calculate_dominance_info): Likewise.
* final.c (compute_alignments): Likewise.
* flow.c (update_life_info, update_life_info_in_dirty_blocks,
delete_noop_moves, calculate_global_regs_live, allocate_bb_life_data,
count_or_remove_death_notes): Likewise.
* gcse.c (oprs_unchanged_p, record_last_reg_set_info,
compute_hash_table, compute_kill_rd, compute_rd, compute_ae_kill,
classic_gcse, compute_transp, cprop, compute_pre_data,
compute_transpout, invalidate_nonnull_info,
delete_null_pointer_checks_1, delete_null_pointer_checks,
compute_code_hoist_vbeinout, hoist_code, compute_ld_motion_mems,
compute_store_table, build_store_vectors, store_motion): Likewise.
* global.c (global_conflicts, mark_elimination): Likewise.
* graph.c (print_rtl_graph_with_bb): Likewise.
* haifa-sched.c (sched_init): Likewise.
* ifcvt.c (if_convert): Likewise.
* lcm.c (compute_antinout_edge, compute_laterin, compute_insert_delete,
compute_available, compute_nearerout, compute_rev_insert_delete,
optimize_mode_switching): Likewise.
* local-alloc.c (local_alloc, update_equiv_regs): Likewise.
* predict.c (estimate_probability, note_prediction_to_br_prob,
propagate_freq, counts_to_freqs, expensive_function_p,
estimate_bb_frequencies): Likewise.
* profile.c (instrument_edges, get_exec_counts,
compute_branch_probabilities, compute_checksum, branch_prob,
find_spanning_tree): Likewise.
* recog.c (split_all_insns, peephole2_optimize): Likewise.
* reg-stack.c (reg_to_stack, convert_regs_entry, convert_regs):
Likewise.
* regclass.c (scan_one_insn, regclass): Likewise.
* regmove.c (mark_flags_life_zones, regmove_optimize,
record_stack_memrefs): Likewise.
* regrename.c (regrename_optimize, copyprop_hardreg_forward): Likewise.
* reload1.c (reload, reload_combine, fixup_abnormal_edges): Likewise.
* resource.c (find_basic_block): Likewise.
* sched-ebb.c (schedule_ebbs): Likewise.
* sched-rgn.c (is_cfg_nonregular, build_control_flow,
find_single_block_region, find_rgns, schedule_insns)
* sibcall.c (optimize_sibling_and_tail_recursive_call)
* ssa-ccp.c (optimize_unexecutable_edges,
ssa_ccp_df_delete_unreachable_insns): Likewise.
* ssa-dce.c (ssa_eliminate_dead_code): Likewise.
* ssa.c (find_evaluations, compute_dominance_frontiers_1,
rename_block, convert_to_ssa, compute_conservative_reg_partition,
compute_coalesced_reg_partition, rename_equivalent_regs,
convert_from_ssa): Likewise.
* config/ia64/ia64.c (emit_predicate_relation_info, process_epilogue,
process_for_unwind_directive): Likewise.
* df.c (FOR_ALL_BBS): Removed.
* gcse.c (struct null_pointer_info): Type of current_block field
changed.
(struct reg_avail_info): Type of last_bb field changed.
* config/ia64/ia64.c (block_num): Removed.
(need_copy_state): Type changed.
(last_block): New.
From-SVN: r53804
2002-05-23 21:23:51 +02:00
|
|
|
|
if (insn == b->end)
|
1997-08-12 06:07:19 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
2000-09-12 18:19:18 +02:00
|
|
|
|
|
2000-12-02 11:47:42 +01:00
|
|
|
|
init_dependency_caches (luid);
|
|
|
|
|
|
|
|
|
|
compute_bb_for_insn (old_max_uid);
|
|
|
|
|
|
|
|
|
|
init_alias_analysis ();
|
|
|
|
|
|
|
|
|
|
if (write_symbols != NO_DEBUG)
|
1999-10-17 23:27:56 +02:00
|
|
|
|
{
|
2000-12-02 11:47:42 +01:00
|
|
|
|
rtx line;
|
|
|
|
|
|
basic-block.h (last_basic_block): Defined as synonym for n_basic_blocks.
* basic-block.h (last_basic_block): Defined as synonym for
n_basic_blocks.
* cfganal.c (mark_dfs_back_edges, flow_reverse_top_sort_order_compute,
flow_depth_first_order_compute, flow_preorder_transversal_compute,
flow_dfs_compute_reverse_init): Replaced relevant occurences of
n_basic_blocks with last_basic_block.
* cfgbuild.c (make_edges): Likewise.
* cfgloop.c (flow_loop_scan, flow_loops_find): Likewise.
* cfgrtl.c (verify_flow_info, purge_all_dead_edges): Likewise.
* combine.c (combine_instructions): Likewise.
* df.c (df_alloc, df_analyse_1, df_analyse, iterative_dataflow_sbitmap,
iterative_dataflow_bitmap): Likewise.
* dominance.c (init_dom_info, calc_dfs_tree_nonrec, calc_dfs_tree,
calc_idoms, idoms_to_doms): Likewise.
* flow.c (update_life_info_in_dirty_blocks, free_basic_block_vars):
Likewise.
* gcse.c (gcse_main, alloc_gcse_mem, compute_local_properties,
compute_hash_table, expr_reaches_here_p, one_classic_gcse_pass,
one_cprop_pass, compute_pre_data, pre_expr_reaches_here_p,
one_pre_gcse_pass, compute_transpout, delete_null_pointer_checks_1,
delete_null_pointer_checks, compute_code_hoist_vbeinout,
hoist_expr_reaches_here_p, hoist_code, one_code_hoisting_pass,
compute_store_table, build_store_vectors): Likewise.
* haifa-sched.c (sched_init): Likewise.
* ifcvt.c (if_convert): Likewise.
* lcm.c (compute_antinout_edge, compute_laterin, compute_insert_delete,
pre_edge_lcm, compute_available, compute_nearerout,
compute_rev_insert_delete, pre_edge_rev_lcm, optimize_mode_switching):
Likewise.
* predict.c (estimate_probability, process_note_prediction,
note_prediction_to_br_prob): Likewise.
* profile.c (GCOV_INDEX_TO_BB, BB_TO_GCOV_INDEX): Likewise.
* recog.c (split_all_insns, peephole2_optimize): Likewise.
* regrename.c (copyprop_hardreg_forward): Likewise.
* resource.c (init_resource_info): Likewise.
* sched-rgn.c (build_control_flow, find_rgns, compute_trg_info,
init_regions, schedule_insns): Likewise.
* ssa-ccp.c (ssa_const_prop): Likewise.
* ssa-dce.c (ssa_eliminate_dead_code): Likewise.
* ssa.c (compute_dominance_frontiers,
compute_iterated_dominance_frontiers, convert_to_ssa): Likewise.
* df.c (df_refs_unlink): Fix FOR_EACH_BB usage (in #if 0'ed code)
* gcse.c (alloc_rd_mem, alloc_avail_expr_mem): Use n_blocks for vector
sizes consistently.
From-SVN: r53924
2002-05-27 15:45:44 +02:00
|
|
|
|
line_note_head = (rtx *) xcalloc (last_basic_block, sizeof (rtx));
|
2000-12-02 11:47:42 +01:00
|
|
|
|
|
|
|
|
|
/* Save-line-note-head:
|
|
|
|
|
Determine the line-number at the start of each basic block.
|
|
|
|
|
This must be computed and saved now, because after a basic block's
|
|
|
|
|
predecessor has been scheduled, it is impossible to accurately
|
|
|
|
|
determine the correct line number for the first insn of the block. */
|
|
|
|
|
|
bb-reorder.c (make_reorder_chain, [...]): Use FOR_EACH_BB macros to iterate over basic block chain.
* bb-reorder.c (make_reorder_chain, make_reorder_chain_1):
Use FOR_EACH_BB macros to iterate over basic block chain.
* cfg.c (clear_edges, clear_bb_flags, dump_flow_info,
alloc_aux_for_blocks, clear_aux_for_blocks, alloc_aux_for_edges):
Likewise.
* cfganal.c (set_edge_can_fallthru_flag, flow_call_edges_add,
find_unreachable_blocks, create_edge_list, verify_edge_list,
remove_fake_edges, add_noreturn_fake_exit_edges,
flow_preorder_transversal_compute, flow_dfs_compute_reverse_execute):
Likewise.
* cfgbuild.c (make_edges, find_basic_blocks, find_many_sub_basic_blocks,
find_sub_basic_blocks): Likewise.
* cfgcleanup.c (try_optimize_cfg, delete_unreachable_blocks):
Likewise.
* cfglayout.c (record_effective_endpoints, cleanup_unconditional_jumps):
Likewise.
* cfgloop.c (flow_loops_cfg_dump, flow_loops_find):
Likewise.
* cfgrtl.c (compute_bb_for_insn, tidy_fallthru_edges,
commit_edge_insertions, commit_edge_insertions_watch_calls,
print_rtl_with_bb, verify_flow_info, purge_all_dead_edges): Likewise.
* combine.c (combine_instructions, reg_dead_at_p): Likewise.
* conflict.c (conflict_graph_compute): Likewise.
* df.c (df_bitmaps_alloc, df_bitmaps_free, df_alloc, df_analyse_1,
df_modified_p, df_refs_unlink, df_dump): Likewise.
* dominance.c (calc_dfs_tree, calculate_dominance_info): Likewise.
* final.c (compute_alignments): Likewise.
* flow.c (update_life_info, update_life_info_in_dirty_blocks,
delete_noop_moves, calculate_global_regs_live, allocate_bb_life_data,
count_or_remove_death_notes): Likewise.
* gcse.c (oprs_unchanged_p, record_last_reg_set_info,
compute_hash_table, compute_kill_rd, compute_rd, compute_ae_kill,
classic_gcse, compute_transp, cprop, compute_pre_data,
compute_transpout, invalidate_nonnull_info,
delete_null_pointer_checks_1, delete_null_pointer_checks,
compute_code_hoist_vbeinout, hoist_code, compute_ld_motion_mems,
compute_store_table, build_store_vectors, store_motion): Likewise.
* global.c (global_conflicts, mark_elimination): Likewise.
* graph.c (print_rtl_graph_with_bb): Likewise.
* haifa-sched.c (sched_init): Likewise.
* ifcvt.c (if_convert): Likewise.
* lcm.c (compute_antinout_edge, compute_laterin, compute_insert_delete,
compute_available, compute_nearerout, compute_rev_insert_delete,
optimize_mode_switching): Likewise.
* local-alloc.c (local_alloc, update_equiv_regs): Likewise.
* predict.c (estimate_probability, note_prediction_to_br_prob,
propagate_freq, counts_to_freqs, expensive_function_p,
estimate_bb_frequencies): Likewise.
* profile.c (instrument_edges, get_exec_counts,
compute_branch_probabilities, compute_checksum, branch_prob,
find_spanning_tree): Likewise.
* recog.c (split_all_insns, peephole2_optimize): Likewise.
* reg-stack.c (reg_to_stack, convert_regs_entry, convert_regs):
Likewise.
* regclass.c (scan_one_insn, regclass): Likewise.
* regmove.c (mark_flags_life_zones, regmove_optimize,
record_stack_memrefs): Likewise.
* regrename.c (regrename_optimize, copyprop_hardreg_forward): Likewise.
* reload1.c (reload, reload_combine, fixup_abnormal_edges): Likewise.
* resource.c (find_basic_block): Likewise.
* sched-ebb.c (schedule_ebbs): Likewise.
* sched-rgn.c (is_cfg_nonregular, build_control_flow,
find_single_block_region, find_rgns, schedule_insns)
* sibcall.c (optimize_sibling_and_tail_recursive_call)
* ssa-ccp.c (optimize_unexecutable_edges,
ssa_ccp_df_delete_unreachable_insns): Likewise.
* ssa-dce.c (ssa_eliminate_dead_code): Likewise.
* ssa.c (find_evaluations, compute_dominance_frontiers_1,
rename_block, convert_to_ssa, compute_conservative_reg_partition,
compute_coalesced_reg_partition, rename_equivalent_regs,
convert_from_ssa): Likewise.
* config/ia64/ia64.c (emit_predicate_relation_info, process_epilogue,
process_for_unwind_directive): Likewise.
* df.c (FOR_ALL_BBS): Removed.
* gcse.c (struct null_pointer_info): Type of current_block field
changed.
(struct reg_avail_info): Type of last_bb field changed.
* config/ia64/ia64.c (block_num): Removed.
(need_copy_state): Type changed.
(last_block): New.
From-SVN: r53804
2002-05-23 21:23:51 +02:00
|
|
|
|
FOR_EACH_BB (b)
|
2000-12-19 18:41:20 +01:00
|
|
|
|
{
|
bb-reorder.c (make_reorder_chain, [...]): Use FOR_EACH_BB macros to iterate over basic block chain.
* bb-reorder.c (make_reorder_chain, make_reorder_chain_1):
Use FOR_EACH_BB macros to iterate over basic block chain.
* cfg.c (clear_edges, clear_bb_flags, dump_flow_info,
alloc_aux_for_blocks, clear_aux_for_blocks, alloc_aux_for_edges):
Likewise.
* cfganal.c (set_edge_can_fallthru_flag, flow_call_edges_add,
find_unreachable_blocks, create_edge_list, verify_edge_list,
remove_fake_edges, add_noreturn_fake_exit_edges,
flow_preorder_transversal_compute, flow_dfs_compute_reverse_execute):
Likewise.
* cfgbuild.c (make_edges, find_basic_blocks, find_many_sub_basic_blocks,
find_sub_basic_blocks): Likewise.
* cfgcleanup.c (try_optimize_cfg, delete_unreachable_blocks):
Likewise.
* cfglayout.c (record_effective_endpoints, cleanup_unconditional_jumps):
Likewise.
* cfgloop.c (flow_loops_cfg_dump, flow_loops_find):
Likewise.
* cfgrtl.c (compute_bb_for_insn, tidy_fallthru_edges,
commit_edge_insertions, commit_edge_insertions_watch_calls,
print_rtl_with_bb, verify_flow_info, purge_all_dead_edges): Likewise.
* combine.c (combine_instructions, reg_dead_at_p): Likewise.
* conflict.c (conflict_graph_compute): Likewise.
* df.c (df_bitmaps_alloc, df_bitmaps_free, df_alloc, df_analyse_1,
df_modified_p, df_refs_unlink, df_dump): Likewise.
* dominance.c (calc_dfs_tree, calculate_dominance_info): Likewise.
* final.c (compute_alignments): Likewise.
* flow.c (update_life_info, update_life_info_in_dirty_blocks,
delete_noop_moves, calculate_global_regs_live, allocate_bb_life_data,
count_or_remove_death_notes): Likewise.
* gcse.c (oprs_unchanged_p, record_last_reg_set_info,
compute_hash_table, compute_kill_rd, compute_rd, compute_ae_kill,
classic_gcse, compute_transp, cprop, compute_pre_data,
compute_transpout, invalidate_nonnull_info,
delete_null_pointer_checks_1, delete_null_pointer_checks,
compute_code_hoist_vbeinout, hoist_code, compute_ld_motion_mems,
compute_store_table, build_store_vectors, store_motion): Likewise.
* global.c (global_conflicts, mark_elimination): Likewise.
* graph.c (print_rtl_graph_with_bb): Likewise.
* haifa-sched.c (sched_init): Likewise.
* ifcvt.c (if_convert): Likewise.
* lcm.c (compute_antinout_edge, compute_laterin, compute_insert_delete,
compute_available, compute_nearerout, compute_rev_insert_delete,
optimize_mode_switching): Likewise.
* local-alloc.c (local_alloc, update_equiv_regs): Likewise.
* predict.c (estimate_probability, note_prediction_to_br_prob,
propagate_freq, counts_to_freqs, expensive_function_p,
estimate_bb_frequencies): Likewise.
* profile.c (instrument_edges, get_exec_counts,
compute_branch_probabilities, compute_checksum, branch_prob,
find_spanning_tree): Likewise.
* recog.c (split_all_insns, peephole2_optimize): Likewise.
* reg-stack.c (reg_to_stack, convert_regs_entry, convert_regs):
Likewise.
* regclass.c (scan_one_insn, regclass): Likewise.
* regmove.c (mark_flags_life_zones, regmove_optimize,
record_stack_memrefs): Likewise.
* regrename.c (regrename_optimize, copyprop_hardreg_forward): Likewise.
* reload1.c (reload, reload_combine, fixup_abnormal_edges): Likewise.
* resource.c (find_basic_block): Likewise.
* sched-ebb.c (schedule_ebbs): Likewise.
* sched-rgn.c (is_cfg_nonregular, build_control_flow,
find_single_block_region, find_rgns, schedule_insns)
* sibcall.c (optimize_sibling_and_tail_recursive_call)
* ssa-ccp.c (optimize_unexecutable_edges,
ssa_ccp_df_delete_unreachable_insns): Likewise.
* ssa-dce.c (ssa_eliminate_dead_code): Likewise.
* ssa.c (find_evaluations, compute_dominance_frontiers_1,
rename_block, convert_to_ssa, compute_conservative_reg_partition,
compute_coalesced_reg_partition, rename_equivalent_regs,
convert_from_ssa): Likewise.
* config/ia64/ia64.c (emit_predicate_relation_info, process_epilogue,
process_for_unwind_directive): Likewise.
* df.c (FOR_ALL_BBS): Removed.
* gcse.c (struct null_pointer_info): Type of current_block field
changed.
(struct reg_avail_info): Type of last_bb field changed.
* config/ia64/ia64.c (block_num): Removed.
(need_copy_state): Type changed.
(last_block): New.
From-SVN: r53804
2002-05-23 21:23:51 +02:00
|
|
|
|
for (line = b->head; line; line = PREV_INSN (line))
|
2000-12-19 18:41:20 +01:00
|
|
|
|
if (GET_CODE (line) == NOTE && NOTE_LINE_NUMBER (line) > 0)
|
|
|
|
|
{
|
bb-reorder.c (make_reorder_chain, [...]): Use FOR_EACH_BB macros to iterate over basic block chain.
* bb-reorder.c (make_reorder_chain, make_reorder_chain_1):
Use FOR_EACH_BB macros to iterate over basic block chain.
* cfg.c (clear_edges, clear_bb_flags, dump_flow_info,
alloc_aux_for_blocks, clear_aux_for_blocks, alloc_aux_for_edges):
Likewise.
* cfganal.c (set_edge_can_fallthru_flag, flow_call_edges_add,
find_unreachable_blocks, create_edge_list, verify_edge_list,
remove_fake_edges, add_noreturn_fake_exit_edges,
flow_preorder_transversal_compute, flow_dfs_compute_reverse_execute):
Likewise.
* cfgbuild.c (make_edges, find_basic_blocks, find_many_sub_basic_blocks,
find_sub_basic_blocks): Likewise.
* cfgcleanup.c (try_optimize_cfg, delete_unreachable_blocks):
Likewise.
* cfglayout.c (record_effective_endpoints, cleanup_unconditional_jumps):
Likewise.
* cfgloop.c (flow_loops_cfg_dump, flow_loops_find):
Likewise.
* cfgrtl.c (compute_bb_for_insn, tidy_fallthru_edges,
commit_edge_insertions, commit_edge_insertions_watch_calls,
print_rtl_with_bb, verify_flow_info, purge_all_dead_edges): Likewise.
* combine.c (combine_instructions, reg_dead_at_p): Likewise.
* conflict.c (conflict_graph_compute): Likewise.
* df.c (df_bitmaps_alloc, df_bitmaps_free, df_alloc, df_analyse_1,
df_modified_p, df_refs_unlink, df_dump): Likewise.
* dominance.c (calc_dfs_tree, calculate_dominance_info): Likewise.
* final.c (compute_alignments): Likewise.
* flow.c (update_life_info, update_life_info_in_dirty_blocks,
delete_noop_moves, calculate_global_regs_live, allocate_bb_life_data,
count_or_remove_death_notes): Likewise.
* gcse.c (oprs_unchanged_p, record_last_reg_set_info,
compute_hash_table, compute_kill_rd, compute_rd, compute_ae_kill,
classic_gcse, compute_transp, cprop, compute_pre_data,
compute_transpout, invalidate_nonnull_info,
delete_null_pointer_checks_1, delete_null_pointer_checks,
compute_code_hoist_vbeinout, hoist_code, compute_ld_motion_mems,
compute_store_table, build_store_vectors, store_motion): Likewise.
* global.c (global_conflicts, mark_elimination): Likewise.
* graph.c (print_rtl_graph_with_bb): Likewise.
* haifa-sched.c (sched_init): Likewise.
* ifcvt.c (if_convert): Likewise.
* lcm.c (compute_antinout_edge, compute_laterin, compute_insert_delete,
compute_available, compute_nearerout, compute_rev_insert_delete,
optimize_mode_switching): Likewise.
* local-alloc.c (local_alloc, update_equiv_regs): Likewise.
* predict.c (estimate_probability, note_prediction_to_br_prob,
propagate_freq, counts_to_freqs, expensive_function_p,
estimate_bb_frequencies): Likewise.
* profile.c (instrument_edges, get_exec_counts,
compute_branch_probabilities, compute_checksum, branch_prob,
find_spanning_tree): Likewise.
* recog.c (split_all_insns, peephole2_optimize): Likewise.
* reg-stack.c (reg_to_stack, convert_regs_entry, convert_regs):
Likewise.
* regclass.c (scan_one_insn, regclass): Likewise.
* regmove.c (mark_flags_life_zones, regmove_optimize,
record_stack_memrefs): Likewise.
* regrename.c (regrename_optimize, copyprop_hardreg_forward): Likewise.
* reload1.c (reload, reload_combine, fixup_abnormal_edges): Likewise.
* resource.c (find_basic_block): Likewise.
* sched-ebb.c (schedule_ebbs): Likewise.
* sched-rgn.c (is_cfg_nonregular, build_control_flow,
find_single_block_region, find_rgns, schedule_insns)
* sibcall.c (optimize_sibling_and_tail_recursive_call)
* ssa-ccp.c (optimize_unexecutable_edges,
ssa_ccp_df_delete_unreachable_insns): Likewise.
* ssa-dce.c (ssa_eliminate_dead_code): Likewise.
* ssa.c (find_evaluations, compute_dominance_frontiers_1,
rename_block, convert_to_ssa, compute_conservative_reg_partition,
compute_coalesced_reg_partition, rename_equivalent_regs,
convert_from_ssa): Likewise.
* config/ia64/ia64.c (emit_predicate_relation_info, process_epilogue,
process_for_unwind_directive): Likewise.
* df.c (FOR_ALL_BBS): Removed.
* gcse.c (struct null_pointer_info): Type of current_block field
changed.
(struct reg_avail_info): Type of last_bb field changed.
* config/ia64/ia64.c (block_num): Removed.
(need_copy_state): Type changed.
(last_block): New.
From-SVN: r53804
2002-05-23 21:23:51 +02:00
|
|
|
|
line_note_head[b->index] = line;
|
2000-12-19 18:41:20 +01:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
/* Do a forward search as well, since we won't get to see the first
|
|
|
|
|
notes in a basic block. */
|
bb-reorder.c (make_reorder_chain, [...]): Use FOR_EACH_BB macros to iterate over basic block chain.
* bb-reorder.c (make_reorder_chain, make_reorder_chain_1):
Use FOR_EACH_BB macros to iterate over basic block chain.
* cfg.c (clear_edges, clear_bb_flags, dump_flow_info,
alloc_aux_for_blocks, clear_aux_for_blocks, alloc_aux_for_edges):
Likewise.
* cfganal.c (set_edge_can_fallthru_flag, flow_call_edges_add,
find_unreachable_blocks, create_edge_list, verify_edge_list,
remove_fake_edges, add_noreturn_fake_exit_edges,
flow_preorder_transversal_compute, flow_dfs_compute_reverse_execute):
Likewise.
* cfgbuild.c (make_edges, find_basic_blocks, find_many_sub_basic_blocks,
find_sub_basic_blocks): Likewise.
* cfgcleanup.c (try_optimize_cfg, delete_unreachable_blocks):
Likewise.
* cfglayout.c (record_effective_endpoints, cleanup_unconditional_jumps):
Likewise.
* cfgloop.c (flow_loops_cfg_dump, flow_loops_find):
Likewise.
* cfgrtl.c (compute_bb_for_insn, tidy_fallthru_edges,
commit_edge_insertions, commit_edge_insertions_watch_calls,
print_rtl_with_bb, verify_flow_info, purge_all_dead_edges): Likewise.
* combine.c (combine_instructions, reg_dead_at_p): Likewise.
* conflict.c (conflict_graph_compute): Likewise.
* df.c (df_bitmaps_alloc, df_bitmaps_free, df_alloc, df_analyse_1,
df_modified_p, df_refs_unlink, df_dump): Likewise.
* dominance.c (calc_dfs_tree, calculate_dominance_info): Likewise.
* final.c (compute_alignments): Likewise.
* flow.c (update_life_info, update_life_info_in_dirty_blocks,
delete_noop_moves, calculate_global_regs_live, allocate_bb_life_data,
count_or_remove_death_notes): Likewise.
* gcse.c (oprs_unchanged_p, record_last_reg_set_info,
compute_hash_table, compute_kill_rd, compute_rd, compute_ae_kill,
classic_gcse, compute_transp, cprop, compute_pre_data,
compute_transpout, invalidate_nonnull_info,
delete_null_pointer_checks_1, delete_null_pointer_checks,
compute_code_hoist_vbeinout, hoist_code, compute_ld_motion_mems,
compute_store_table, build_store_vectors, store_motion): Likewise.
* global.c (global_conflicts, mark_elimination): Likewise.
* graph.c (print_rtl_graph_with_bb): Likewise.
* haifa-sched.c (sched_init): Likewise.
* ifcvt.c (if_convert): Likewise.
* lcm.c (compute_antinout_edge, compute_laterin, compute_insert_delete,
compute_available, compute_nearerout, compute_rev_insert_delete,
optimize_mode_switching): Likewise.
* local-alloc.c (local_alloc, update_equiv_regs): Likewise.
* predict.c (estimate_probability, note_prediction_to_br_prob,
propagate_freq, counts_to_freqs, expensive_function_p,
estimate_bb_frequencies): Likewise.
* profile.c (instrument_edges, get_exec_counts,
compute_branch_probabilities, compute_checksum, branch_prob,
find_spanning_tree): Likewise.
* recog.c (split_all_insns, peephole2_optimize): Likewise.
* reg-stack.c (reg_to_stack, convert_regs_entry, convert_regs):
Likewise.
* regclass.c (scan_one_insn, regclass): Likewise.
* regmove.c (mark_flags_life_zones, regmove_optimize,
record_stack_memrefs): Likewise.
* regrename.c (regrename_optimize, copyprop_hardreg_forward): Likewise.
* reload1.c (reload, reload_combine, fixup_abnormal_edges): Likewise.
* resource.c (find_basic_block): Likewise.
* sched-ebb.c (schedule_ebbs): Likewise.
* sched-rgn.c (is_cfg_nonregular, build_control_flow,
find_single_block_region, find_rgns, schedule_insns)
* sibcall.c (optimize_sibling_and_tail_recursive_call)
* ssa-ccp.c (optimize_unexecutable_edges,
ssa_ccp_df_delete_unreachable_insns): Likewise.
* ssa-dce.c (ssa_eliminate_dead_code): Likewise.
* ssa.c (find_evaluations, compute_dominance_frontiers_1,
rename_block, convert_to_ssa, compute_conservative_reg_partition,
compute_coalesced_reg_partition, rename_equivalent_regs,
convert_from_ssa): Likewise.
* config/ia64/ia64.c (emit_predicate_relation_info, process_epilogue,
process_for_unwind_directive): Likewise.
* df.c (FOR_ALL_BBS): Removed.
* gcse.c (struct null_pointer_info): Type of current_block field
changed.
(struct reg_avail_info): Type of last_bb field changed.
* config/ia64/ia64.c (block_num): Removed.
(need_copy_state): Type changed.
(last_block): New.
From-SVN: r53804
2002-05-23 21:23:51 +02:00
|
|
|
|
for (line = b->head; line; line = NEXT_INSN (line))
|
2000-12-02 11:47:42 +01:00
|
|
|
|
{
|
2000-12-19 18:41:20 +01:00
|
|
|
|
if (INSN_P (line))
|
|
|
|
|
break;
|
|
|
|
|
if (GET_CODE (line) == NOTE && NOTE_LINE_NUMBER (line) > 0)
|
bb-reorder.c (make_reorder_chain, [...]): Use FOR_EACH_BB macros to iterate over basic block chain.
* bb-reorder.c (make_reorder_chain, make_reorder_chain_1):
Use FOR_EACH_BB macros to iterate over basic block chain.
* cfg.c (clear_edges, clear_bb_flags, dump_flow_info,
alloc_aux_for_blocks, clear_aux_for_blocks, alloc_aux_for_edges):
Likewise.
* cfganal.c (set_edge_can_fallthru_flag, flow_call_edges_add,
find_unreachable_blocks, create_edge_list, verify_edge_list,
remove_fake_edges, add_noreturn_fake_exit_edges,
flow_preorder_transversal_compute, flow_dfs_compute_reverse_execute):
Likewise.
* cfgbuild.c (make_edges, find_basic_blocks, find_many_sub_basic_blocks,
find_sub_basic_blocks): Likewise.
* cfgcleanup.c (try_optimize_cfg, delete_unreachable_blocks):
Likewise.
* cfglayout.c (record_effective_endpoints, cleanup_unconditional_jumps):
Likewise.
* cfgloop.c (flow_loops_cfg_dump, flow_loops_find):
Likewise.
* cfgrtl.c (compute_bb_for_insn, tidy_fallthru_edges,
commit_edge_insertions, commit_edge_insertions_watch_calls,
print_rtl_with_bb, verify_flow_info, purge_all_dead_edges): Likewise.
* combine.c (combine_instructions, reg_dead_at_p): Likewise.
* conflict.c (conflict_graph_compute): Likewise.
* df.c (df_bitmaps_alloc, df_bitmaps_free, df_alloc, df_analyse_1,
df_modified_p, df_refs_unlink, df_dump): Likewise.
* dominance.c (calc_dfs_tree, calculate_dominance_info): Likewise.
* final.c (compute_alignments): Likewise.
* flow.c (update_life_info, update_life_info_in_dirty_blocks,
delete_noop_moves, calculate_global_regs_live, allocate_bb_life_data,
count_or_remove_death_notes): Likewise.
* gcse.c (oprs_unchanged_p, record_last_reg_set_info,
compute_hash_table, compute_kill_rd, compute_rd, compute_ae_kill,
classic_gcse, compute_transp, cprop, compute_pre_data,
compute_transpout, invalidate_nonnull_info,
delete_null_pointer_checks_1, delete_null_pointer_checks,
compute_code_hoist_vbeinout, hoist_code, compute_ld_motion_mems,
compute_store_table, build_store_vectors, store_motion): Likewise.
* global.c (global_conflicts, mark_elimination): Likewise.
* graph.c (print_rtl_graph_with_bb): Likewise.
* haifa-sched.c (sched_init): Likewise.
* ifcvt.c (if_convert): Likewise.
* lcm.c (compute_antinout_edge, compute_laterin, compute_insert_delete,
compute_available, compute_nearerout, compute_rev_insert_delete,
optimize_mode_switching): Likewise.
* local-alloc.c (local_alloc, update_equiv_regs): Likewise.
* predict.c (estimate_probability, note_prediction_to_br_prob,
propagate_freq, counts_to_freqs, expensive_function_p,
estimate_bb_frequencies): Likewise.
* profile.c (instrument_edges, get_exec_counts,
compute_branch_probabilities, compute_checksum, branch_prob,
find_spanning_tree): Likewise.
* recog.c (split_all_insns, peephole2_optimize): Likewise.
* reg-stack.c (reg_to_stack, convert_regs_entry, convert_regs):
Likewise.
* regclass.c (scan_one_insn, regclass): Likewise.
* regmove.c (mark_flags_life_zones, regmove_optimize,
record_stack_memrefs): Likewise.
* regrename.c (regrename_optimize, copyprop_hardreg_forward): Likewise.
* reload1.c (reload, reload_combine, fixup_abnormal_edges): Likewise.
* resource.c (find_basic_block): Likewise.
* sched-ebb.c (schedule_ebbs): Likewise.
* sched-rgn.c (is_cfg_nonregular, build_control_flow,
find_single_block_region, find_rgns, schedule_insns)
* sibcall.c (optimize_sibling_and_tail_recursive_call)
* ssa-ccp.c (optimize_unexecutable_edges,
ssa_ccp_df_delete_unreachable_insns): Likewise.
* ssa-dce.c (ssa_eliminate_dead_code): Likewise.
* ssa.c (find_evaluations, compute_dominance_frontiers_1,
rename_block, convert_to_ssa, compute_conservative_reg_partition,
compute_coalesced_reg_partition, rename_equivalent_regs,
convert_from_ssa): Likewise.
* config/ia64/ia64.c (emit_predicate_relation_info, process_epilogue,
process_for_unwind_directive): Likewise.
* df.c (FOR_ALL_BBS): Removed.
* gcse.c (struct null_pointer_info): Type of current_block field
changed.
(struct reg_avail_info): Type of last_bb field changed.
* config/ia64/ia64.c (block_num): Removed.
(need_copy_state): Type changed.
(last_block): New.
From-SVN: r53804
2002-05-23 21:23:51 +02:00
|
|
|
|
line_note_head[b->index] = line;
|
2000-12-02 11:47:42 +01:00
|
|
|
|
}
|
2000-12-19 18:41:20 +01:00
|
|
|
|
}
|
1999-10-17 23:27:56 +02:00
|
|
|
|
}
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2002-04-30 00:34:36 +02:00
|
|
|
|
if ((!targetm.sched.use_dfa_pipeline_interface
|
|
|
|
|
|| !(*targetm.sched.use_dfa_pipeline_interface) ())
|
|
|
|
|
&& sched_verbose)
|
|
|
|
|
/* Find units used in this function, for visualization. */
|
2000-12-02 11:47:42 +01:00
|
|
|
|
init_target_units ();
|
|
|
|
|
|
|
|
|
|
/* ??? Add a NOTE after the last insn of the last basic block. It is not
|
|
|
|
|
known why this is done. */
|
|
|
|
|
|
bb-reorder.c (make_reorder_chain, [...]): Use FOR_EACH_BB macros to iterate over basic block chain.
* bb-reorder.c (make_reorder_chain, make_reorder_chain_1):
Use FOR_EACH_BB macros to iterate over basic block chain.
* cfg.c (clear_edges, clear_bb_flags, dump_flow_info,
alloc_aux_for_blocks, clear_aux_for_blocks, alloc_aux_for_edges):
Likewise.
* cfganal.c (set_edge_can_fallthru_flag, flow_call_edges_add,
find_unreachable_blocks, create_edge_list, verify_edge_list,
remove_fake_edges, add_noreturn_fake_exit_edges,
flow_preorder_transversal_compute, flow_dfs_compute_reverse_execute):
Likewise.
* cfgbuild.c (make_edges, find_basic_blocks, find_many_sub_basic_blocks,
find_sub_basic_blocks): Likewise.
* cfgcleanup.c (try_optimize_cfg, delete_unreachable_blocks):
Likewise.
* cfglayout.c (record_effective_endpoints, cleanup_unconditional_jumps):
Likewise.
* cfgloop.c (flow_loops_cfg_dump, flow_loops_find):
Likewise.
* cfgrtl.c (compute_bb_for_insn, tidy_fallthru_edges,
commit_edge_insertions, commit_edge_insertions_watch_calls,
print_rtl_with_bb, verify_flow_info, purge_all_dead_edges): Likewise.
* combine.c (combine_instructions, reg_dead_at_p): Likewise.
* conflict.c (conflict_graph_compute): Likewise.
* df.c (df_bitmaps_alloc, df_bitmaps_free, df_alloc, df_analyse_1,
df_modified_p, df_refs_unlink, df_dump): Likewise.
* dominance.c (calc_dfs_tree, calculate_dominance_info): Likewise.
* final.c (compute_alignments): Likewise.
* flow.c (update_life_info, update_life_info_in_dirty_blocks,
delete_noop_moves, calculate_global_regs_live, allocate_bb_life_data,
count_or_remove_death_notes): Likewise.
* gcse.c (oprs_unchanged_p, record_last_reg_set_info,
compute_hash_table, compute_kill_rd, compute_rd, compute_ae_kill,
classic_gcse, compute_transp, cprop, compute_pre_data,
compute_transpout, invalidate_nonnull_info,
delete_null_pointer_checks_1, delete_null_pointer_checks,
compute_code_hoist_vbeinout, hoist_code, compute_ld_motion_mems,
compute_store_table, build_store_vectors, store_motion): Likewise.
* global.c (global_conflicts, mark_elimination): Likewise.
* graph.c (print_rtl_graph_with_bb): Likewise.
* haifa-sched.c (sched_init): Likewise.
* ifcvt.c (if_convert): Likewise.
* lcm.c (compute_antinout_edge, compute_laterin, compute_insert_delete,
compute_available, compute_nearerout, compute_rev_insert_delete,
optimize_mode_switching): Likewise.
* local-alloc.c (local_alloc, update_equiv_regs): Likewise.
* predict.c (estimate_probability, note_prediction_to_br_prob,
propagate_freq, counts_to_freqs, expensive_function_p,
estimate_bb_frequencies): Likewise.
* profile.c (instrument_edges, get_exec_counts,
compute_branch_probabilities, compute_checksum, branch_prob,
find_spanning_tree): Likewise.
* recog.c (split_all_insns, peephole2_optimize): Likewise.
* reg-stack.c (reg_to_stack, convert_regs_entry, convert_regs):
Likewise.
* regclass.c (scan_one_insn, regclass): Likewise.
* regmove.c (mark_flags_life_zones, regmove_optimize,
record_stack_memrefs): Likewise.
* regrename.c (regrename_optimize, copyprop_hardreg_forward): Likewise.
* reload1.c (reload, reload_combine, fixup_abnormal_edges): Likewise.
* resource.c (find_basic_block): Likewise.
* sched-ebb.c (schedule_ebbs): Likewise.
* sched-rgn.c (is_cfg_nonregular, build_control_flow,
find_single_block_region, find_rgns, schedule_insns)
* sibcall.c (optimize_sibling_and_tail_recursive_call)
* ssa-ccp.c (optimize_unexecutable_edges,
ssa_ccp_df_delete_unreachable_insns): Likewise.
* ssa-dce.c (ssa_eliminate_dead_code): Likewise.
* ssa.c (find_evaluations, compute_dominance_frontiers_1,
rename_block, convert_to_ssa, compute_conservative_reg_partition,
compute_coalesced_reg_partition, rename_equivalent_regs,
convert_from_ssa): Likewise.
* config/ia64/ia64.c (emit_predicate_relation_info, process_epilogue,
process_for_unwind_directive): Likewise.
* df.c (FOR_ALL_BBS): Removed.
* gcse.c (struct null_pointer_info): Type of current_block field
changed.
(struct reg_avail_info): Type of last_bb field changed.
* config/ia64/ia64.c (block_num): Removed.
(need_copy_state): Type changed.
(last_block): New.
From-SVN: r53804
2002-05-23 21:23:51 +02:00
|
|
|
|
insn = EXIT_BLOCK_PTR->prev_bb->end;
|
2000-12-02 11:47:42 +01:00
|
|
|
|
if (NEXT_INSN (insn) == 0
|
|
|
|
|
|| (GET_CODE (insn) != NOTE
|
|
|
|
|
&& GET_CODE (insn) != CODE_LABEL
|
2000-12-15 04:40:57 +01:00
|
|
|
|
/* Don't emit a NOTE if it would end up before a BARRIER. */
|
|
|
|
|
&& GET_CODE (NEXT_INSN (insn)) != BARRIER))
|
2001-09-16 22:21:30 +02:00
|
|
|
|
{
|
bb-reorder.c (make_reorder_chain, [...]): Use FOR_EACH_BB macros to iterate over basic block chain.
* bb-reorder.c (make_reorder_chain, make_reorder_chain_1):
Use FOR_EACH_BB macros to iterate over basic block chain.
* cfg.c (clear_edges, clear_bb_flags, dump_flow_info,
alloc_aux_for_blocks, clear_aux_for_blocks, alloc_aux_for_edges):
Likewise.
* cfganal.c (set_edge_can_fallthru_flag, flow_call_edges_add,
find_unreachable_blocks, create_edge_list, verify_edge_list,
remove_fake_edges, add_noreturn_fake_exit_edges,
flow_preorder_transversal_compute, flow_dfs_compute_reverse_execute):
Likewise.
* cfgbuild.c (make_edges, find_basic_blocks, find_many_sub_basic_blocks,
find_sub_basic_blocks): Likewise.
* cfgcleanup.c (try_optimize_cfg, delete_unreachable_blocks):
Likewise.
* cfglayout.c (record_effective_endpoints, cleanup_unconditional_jumps):
Likewise.
* cfgloop.c (flow_loops_cfg_dump, flow_loops_find):
Likewise.
* cfgrtl.c (compute_bb_for_insn, tidy_fallthru_edges,
commit_edge_insertions, commit_edge_insertions_watch_calls,
print_rtl_with_bb, verify_flow_info, purge_all_dead_edges): Likewise.
* combine.c (combine_instructions, reg_dead_at_p): Likewise.
* conflict.c (conflict_graph_compute): Likewise.
* df.c (df_bitmaps_alloc, df_bitmaps_free, df_alloc, df_analyse_1,
df_modified_p, df_refs_unlink, df_dump): Likewise.
* dominance.c (calc_dfs_tree, calculate_dominance_info): Likewise.
* final.c (compute_alignments): Likewise.
* flow.c (update_life_info, update_life_info_in_dirty_blocks,
delete_noop_moves, calculate_global_regs_live, allocate_bb_life_data,
count_or_remove_death_notes): Likewise.
* gcse.c (oprs_unchanged_p, record_last_reg_set_info,
compute_hash_table, compute_kill_rd, compute_rd, compute_ae_kill,
classic_gcse, compute_transp, cprop, compute_pre_data,
compute_transpout, invalidate_nonnull_info,
delete_null_pointer_checks_1, delete_null_pointer_checks,
compute_code_hoist_vbeinout, hoist_code, compute_ld_motion_mems,
compute_store_table, build_store_vectors, store_motion): Likewise.
* global.c (global_conflicts, mark_elimination): Likewise.
* graph.c (print_rtl_graph_with_bb): Likewise.
* haifa-sched.c (sched_init): Likewise.
* ifcvt.c (if_convert): Likewise.
* lcm.c (compute_antinout_edge, compute_laterin, compute_insert_delete,
compute_available, compute_nearerout, compute_rev_insert_delete,
optimize_mode_switching): Likewise.
* local-alloc.c (local_alloc, update_equiv_regs): Likewise.
* predict.c (estimate_probability, note_prediction_to_br_prob,
propagate_freq, counts_to_freqs, expensive_function_p,
estimate_bb_frequencies): Likewise.
* profile.c (instrument_edges, get_exec_counts,
compute_branch_probabilities, compute_checksum, branch_prob,
find_spanning_tree): Likewise.
* recog.c (split_all_insns, peephole2_optimize): Likewise.
* reg-stack.c (reg_to_stack, convert_regs_entry, convert_regs):
Likewise.
* regclass.c (scan_one_insn, regclass): Likewise.
* regmove.c (mark_flags_life_zones, regmove_optimize,
record_stack_memrefs): Likewise.
* regrename.c (regrename_optimize, copyprop_hardreg_forward): Likewise.
* reload1.c (reload, reload_combine, fixup_abnormal_edges): Likewise.
* resource.c (find_basic_block): Likewise.
* sched-ebb.c (schedule_ebbs): Likewise.
* sched-rgn.c (is_cfg_nonregular, build_control_flow,
find_single_block_region, find_rgns, schedule_insns)
* sibcall.c (optimize_sibling_and_tail_recursive_call)
* ssa-ccp.c (optimize_unexecutable_edges,
ssa_ccp_df_delete_unreachable_insns): Likewise.
* ssa-dce.c (ssa_eliminate_dead_code): Likewise.
* ssa.c (find_evaluations, compute_dominance_frontiers_1,
rename_block, convert_to_ssa, compute_conservative_reg_partition,
compute_coalesced_reg_partition, rename_equivalent_regs,
convert_from_ssa): Likewise.
* config/ia64/ia64.c (emit_predicate_relation_info, process_epilogue,
process_for_unwind_directive): Likewise.
* df.c (FOR_ALL_BBS): Removed.
* gcse.c (struct null_pointer_info): Type of current_block field
changed.
(struct reg_avail_info): Type of last_bb field changed.
* config/ia64/ia64.c (block_num): Removed.
(need_copy_state): Type changed.
(last_block): New.
From-SVN: r53804
2002-05-23 21:23:51 +02:00
|
|
|
|
emit_note_after (NOTE_INSN_DELETED, EXIT_BLOCK_PTR->prev_bb->end);
|
2001-09-16 22:21:30 +02:00
|
|
|
|
/* Make insn to appear outside BB. */
|
bb-reorder.c (make_reorder_chain, [...]): Use FOR_EACH_BB macros to iterate over basic block chain.
* bb-reorder.c (make_reorder_chain, make_reorder_chain_1):
Use FOR_EACH_BB macros to iterate over basic block chain.
* cfg.c (clear_edges, clear_bb_flags, dump_flow_info,
alloc_aux_for_blocks, clear_aux_for_blocks, alloc_aux_for_edges):
Likewise.
* cfganal.c (set_edge_can_fallthru_flag, flow_call_edges_add,
find_unreachable_blocks, create_edge_list, verify_edge_list,
remove_fake_edges, add_noreturn_fake_exit_edges,
flow_preorder_transversal_compute, flow_dfs_compute_reverse_execute):
Likewise.
* cfgbuild.c (make_edges, find_basic_blocks, find_many_sub_basic_blocks,
find_sub_basic_blocks): Likewise.
* cfgcleanup.c (try_optimize_cfg, delete_unreachable_blocks):
Likewise.
* cfglayout.c (record_effective_endpoints, cleanup_unconditional_jumps):
Likewise.
* cfgloop.c (flow_loops_cfg_dump, flow_loops_find):
Likewise.
* cfgrtl.c (compute_bb_for_insn, tidy_fallthru_edges,
commit_edge_insertions, commit_edge_insertions_watch_calls,
print_rtl_with_bb, verify_flow_info, purge_all_dead_edges): Likewise.
* combine.c (combine_instructions, reg_dead_at_p): Likewise.
* conflict.c (conflict_graph_compute): Likewise.
* df.c (df_bitmaps_alloc, df_bitmaps_free, df_alloc, df_analyse_1,
df_modified_p, df_refs_unlink, df_dump): Likewise.
* dominance.c (calc_dfs_tree, calculate_dominance_info): Likewise.
* final.c (compute_alignments): Likewise.
* flow.c (update_life_info, update_life_info_in_dirty_blocks,
delete_noop_moves, calculate_global_regs_live, allocate_bb_life_data,
count_or_remove_death_notes): Likewise.
* gcse.c (oprs_unchanged_p, record_last_reg_set_info,
compute_hash_table, compute_kill_rd, compute_rd, compute_ae_kill,
classic_gcse, compute_transp, cprop, compute_pre_data,
compute_transpout, invalidate_nonnull_info,
delete_null_pointer_checks_1, delete_null_pointer_checks,
compute_code_hoist_vbeinout, hoist_code, compute_ld_motion_mems,
compute_store_table, build_store_vectors, store_motion): Likewise.
* global.c (global_conflicts, mark_elimination): Likewise.
* graph.c (print_rtl_graph_with_bb): Likewise.
* haifa-sched.c (sched_init): Likewise.
* ifcvt.c (if_convert): Likewise.
* lcm.c (compute_antinout_edge, compute_laterin, compute_insert_delete,
compute_available, compute_nearerout, compute_rev_insert_delete,
optimize_mode_switching): Likewise.
* local-alloc.c (local_alloc, update_equiv_regs): Likewise.
* predict.c (estimate_probability, note_prediction_to_br_prob,
propagate_freq, counts_to_freqs, expensive_function_p,
estimate_bb_frequencies): Likewise.
* profile.c (instrument_edges, get_exec_counts,
compute_branch_probabilities, compute_checksum, branch_prob,
find_spanning_tree): Likewise.
* recog.c (split_all_insns, peephole2_optimize): Likewise.
* reg-stack.c (reg_to_stack, convert_regs_entry, convert_regs):
Likewise.
* regclass.c (scan_one_insn, regclass): Likewise.
* regmove.c (mark_flags_life_zones, regmove_optimize,
record_stack_memrefs): Likewise.
* regrename.c (regrename_optimize, copyprop_hardreg_forward): Likewise.
* reload1.c (reload, reload_combine, fixup_abnormal_edges): Likewise.
* resource.c (find_basic_block): Likewise.
* sched-ebb.c (schedule_ebbs): Likewise.
* sched-rgn.c (is_cfg_nonregular, build_control_flow,
find_single_block_region, find_rgns, schedule_insns)
* sibcall.c (optimize_sibling_and_tail_recursive_call)
* ssa-ccp.c (optimize_unexecutable_edges,
ssa_ccp_df_delete_unreachable_insns): Likewise.
* ssa-dce.c (ssa_eliminate_dead_code): Likewise.
* ssa.c (find_evaluations, compute_dominance_frontiers_1,
rename_block, convert_to_ssa, compute_conservative_reg_partition,
compute_coalesced_reg_partition, rename_equivalent_regs,
convert_from_ssa): Likewise.
* config/ia64/ia64.c (emit_predicate_relation_info, process_epilogue,
process_for_unwind_directive): Likewise.
* df.c (FOR_ALL_BBS): Removed.
* gcse.c (struct null_pointer_info): Type of current_block field
changed.
(struct reg_avail_info): Type of last_bb field changed.
* config/ia64/ia64.c (block_num): Removed.
(need_copy_state): Type changed.
(last_block): New.
From-SVN: r53804
2002-05-23 21:23:51 +02:00
|
|
|
|
EXIT_BLOCK_PTR->prev_bb->end = PREV_INSN (EXIT_BLOCK_PTR->prev_bb->end);
|
2001-09-16 22:21:30 +02:00
|
|
|
|
}
|
2000-12-02 11:47:42 +01:00
|
|
|
|
|
|
|
|
|
/* Compute INSN_REG_WEIGHT for all blocks. We must do this before
|
|
|
|
|
removing death notes. */
|
bb-reorder.c (make_reorder_chain, [...]): Use FOR_EACH_BB macros to iterate over basic block chain.
* bb-reorder.c (make_reorder_chain, make_reorder_chain_1):
Use FOR_EACH_BB macros to iterate over basic block chain.
* cfg.c (clear_edges, clear_bb_flags, dump_flow_info,
alloc_aux_for_blocks, clear_aux_for_blocks, alloc_aux_for_edges):
Likewise.
* cfganal.c (set_edge_can_fallthru_flag, flow_call_edges_add,
find_unreachable_blocks, create_edge_list, verify_edge_list,
remove_fake_edges, add_noreturn_fake_exit_edges,
flow_preorder_transversal_compute, flow_dfs_compute_reverse_execute):
Likewise.
* cfgbuild.c (make_edges, find_basic_blocks, find_many_sub_basic_blocks,
find_sub_basic_blocks): Likewise.
* cfgcleanup.c (try_optimize_cfg, delete_unreachable_blocks):
Likewise.
* cfglayout.c (record_effective_endpoints, cleanup_unconditional_jumps):
Likewise.
* cfgloop.c (flow_loops_cfg_dump, flow_loops_find):
Likewise.
* cfgrtl.c (compute_bb_for_insn, tidy_fallthru_edges,
commit_edge_insertions, commit_edge_insertions_watch_calls,
print_rtl_with_bb, verify_flow_info, purge_all_dead_edges): Likewise.
* combine.c (combine_instructions, reg_dead_at_p): Likewise.
* conflict.c (conflict_graph_compute): Likewise.
* df.c (df_bitmaps_alloc, df_bitmaps_free, df_alloc, df_analyse_1,
df_modified_p, df_refs_unlink, df_dump): Likewise.
* dominance.c (calc_dfs_tree, calculate_dominance_info): Likewise.
* final.c (compute_alignments): Likewise.
* flow.c (update_life_info, update_life_info_in_dirty_blocks,
delete_noop_moves, calculate_global_regs_live, allocate_bb_life_data,
count_or_remove_death_notes): Likewise.
* gcse.c (oprs_unchanged_p, record_last_reg_set_info,
compute_hash_table, compute_kill_rd, compute_rd, compute_ae_kill,
classic_gcse, compute_transp, cprop, compute_pre_data,
compute_transpout, invalidate_nonnull_info,
delete_null_pointer_checks_1, delete_null_pointer_checks,
compute_code_hoist_vbeinout, hoist_code, compute_ld_motion_mems,
compute_store_table, build_store_vectors, store_motion): Likewise.
* global.c (global_conflicts, mark_elimination): Likewise.
* graph.c (print_rtl_graph_with_bb): Likewise.
* haifa-sched.c (sched_init): Likewise.
* ifcvt.c (if_convert): Likewise.
* lcm.c (compute_antinout_edge, compute_laterin, compute_insert_delete,
compute_available, compute_nearerout, compute_rev_insert_delete,
optimize_mode_switching): Likewise.
* local-alloc.c (local_alloc, update_equiv_regs): Likewise.
* predict.c (estimate_probability, note_prediction_to_br_prob,
propagate_freq, counts_to_freqs, expensive_function_p,
estimate_bb_frequencies): Likewise.
* profile.c (instrument_edges, get_exec_counts,
compute_branch_probabilities, compute_checksum, branch_prob,
find_spanning_tree): Likewise.
* recog.c (split_all_insns, peephole2_optimize): Likewise.
* reg-stack.c (reg_to_stack, convert_regs_entry, convert_regs):
Likewise.
* regclass.c (scan_one_insn, regclass): Likewise.
* regmove.c (mark_flags_life_zones, regmove_optimize,
record_stack_memrefs): Likewise.
* regrename.c (regrename_optimize, copyprop_hardreg_forward): Likewise.
* reload1.c (reload, reload_combine, fixup_abnormal_edges): Likewise.
* resource.c (find_basic_block): Likewise.
* sched-ebb.c (schedule_ebbs): Likewise.
* sched-rgn.c (is_cfg_nonregular, build_control_flow,
find_single_block_region, find_rgns, schedule_insns)
* sibcall.c (optimize_sibling_and_tail_recursive_call)
* ssa-ccp.c (optimize_unexecutable_edges,
ssa_ccp_df_delete_unreachable_insns): Likewise.
* ssa-dce.c (ssa_eliminate_dead_code): Likewise.
* ssa.c (find_evaluations, compute_dominance_frontiers_1,
rename_block, convert_to_ssa, compute_conservative_reg_partition,
compute_coalesced_reg_partition, rename_equivalent_regs,
convert_from_ssa): Likewise.
* config/ia64/ia64.c (emit_predicate_relation_info, process_epilogue,
process_for_unwind_directive): Likewise.
* df.c (FOR_ALL_BBS): Removed.
* gcse.c (struct null_pointer_info): Type of current_block field
changed.
(struct reg_avail_info): Type of last_bb field changed.
* config/ia64/ia64.c (block_num): Removed.
(need_copy_state): Type changed.
(last_block): New.
From-SVN: r53804
2002-05-23 21:23:51 +02:00
|
|
|
|
FOR_EACH_BB_REVERSE (b)
|
|
|
|
|
find_insn_reg_weight (b->index);
|
2000-12-02 11:47:42 +01:00
|
|
|
|
}
|
|
|
|
|
|
2000-12-03 20:00:00 +01:00
|
|
|
|
/* Free global data used during insn scheduling. */
|
1997-08-12 06:07:19 +02:00
|
|
|
|
|
2000-12-02 11:47:42 +01:00
|
|
|
|
void
|
2000-12-03 20:00:00 +01:00
|
|
|
|
sched_finish ()
|
2000-12-02 11:47:42 +01:00
|
|
|
|
{
|
haifa-sched.c (struct haifa_insn_data, h_i_d): New.
* haifa-sched.c (struct haifa_insn_data, h_i_d): New.
(insn_luid, insn_priority, insn_costs, insn_units): Remove.
(insn_reg_weight, insn_depend, insn_dep_count): Remove.
(insn_blockage, insn_ref_count, line_note, insn_tick): Remove.
(cant_move, fed_by_spec_load, is_load_insn): Remove.
(schedule_region): Remove unused variable.
(schedule_insns): Allocate h_i_d, and not all the separate arrays.
From-SVN: r30435
1999-11-06 20:41:37 +01:00
|
|
|
|
free (h_i_d);
|
2002-04-30 00:34:36 +02:00
|
|
|
|
|
|
|
|
|
if (targetm.sched.use_dfa_pipeline_interface
|
|
|
|
|
&& (*targetm.sched.use_dfa_pipeline_interface) ())
|
|
|
|
|
{
|
|
|
|
|
free (curr_state);
|
|
|
|
|
dfa_finish ();
|
|
|
|
|
}
|
2000-12-03 20:00:00 +01:00
|
|
|
|
free_dependency_caches ();
|
|
|
|
|
end_alias_analysis ();
|
1998-06-18 22:17:26 +02:00
|
|
|
|
if (write_symbols != NO_DEBUG)
|
haifa-sched.c (struct haifa_insn_data, h_i_d): New.
* haifa-sched.c (struct haifa_insn_data, h_i_d): New.
(insn_luid, insn_priority, insn_costs, insn_units): Remove.
(insn_reg_weight, insn_depend, insn_dep_count): Remove.
(insn_blockage, insn_ref_count, line_note, insn_tick): Remove.
(cant_move, fed_by_spec_load, is_load_insn): Remove.
(schedule_region): Remove unused variable.
(schedule_insns): Allocate h_i_d, and not all the separate arrays.
From-SVN: r30435
1999-11-06 20:41:37 +01:00
|
|
|
|
free (line_note_head);
|
1997-08-12 06:07:19 +02:00
|
|
|
|
}
|
|
|
|
|
#endif /* INSN_SCHEDULING */
|