1991-12-26 11:05:42 +01:00
|
|
|
|
/* Register to Stack convert for GNU compiler.
|
2000-02-26 15:26:24 +01:00
|
|
|
|
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998,
|
2002-01-10 01:56:56 +01:00
|
|
|
|
1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
1991-12-26 11:05:42 +01: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
|
|
|
|
This file is part of GCC.
|
1991-12-26 11:05:42 +01: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
|
1999-10-27 03:25:13 +02:00
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
|
any later version.
|
1991-12-26 11:05:42 +01: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 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|
|
|
|
License for more details.
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
You should have received a copy of the GNU General Public License
|
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
|
|
|
|
along with GCC; see the file COPYING. If not, write to the Free
|
|
|
|
|
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
|
02111-1307, USA. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
/* This pass converts stack-like registers from the "flat register
|
|
|
|
|
file" model that gcc uses, to a stack convention that the 387 uses.
|
|
|
|
|
|
|
|
|
|
* The form of the input:
|
|
|
|
|
|
|
|
|
|
On input, the function consists of insn that have had their
|
|
|
|
|
registers fully allocated to a set of "virtual" registers. Note that
|
|
|
|
|
the word "virtual" is used differently here than elsewhere in gcc: for
|
|
|
|
|
each virtual stack reg, there is a hard reg, but the mapping between
|
|
|
|
|
them is not known until this pass is run. On output, hard register
|
|
|
|
|
numbers have been substituted, and various pop and exchange insns have
|
|
|
|
|
been emitted. The hard register numbers and the virtual register
|
|
|
|
|
numbers completely overlap - before this pass, all stack register
|
1992-01-19 05:23:39 +01:00
|
|
|
|
numbers are virtual, and afterward they are all hard.
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
The virtual registers can be manipulated normally by gcc, and their
|
|
|
|
|
semantics are the same as for normal registers. After the hard
|
|
|
|
|
register numbers are substituted, the semantics of an insn containing
|
|
|
|
|
stack-like regs are not the same as for an insn with normal regs: for
|
|
|
|
|
instance, it is not safe to delete an insn that appears to be a no-op
|
|
|
|
|
move. In general, no insn containing hard regs should be changed
|
|
|
|
|
after this pass is done.
|
|
|
|
|
|
|
|
|
|
* The form of the output:
|
|
|
|
|
|
|
|
|
|
After this pass, hard register numbers represent the distance from
|
|
|
|
|
the current top of stack to the desired register. A reference to
|
|
|
|
|
FIRST_STACK_REG references the top of stack, FIRST_STACK_REG + 1,
|
|
|
|
|
represents the register just below that, and so forth. Also, REG_DEAD
|
|
|
|
|
notes indicate whether or not a stack register should be popped.
|
|
|
|
|
|
|
|
|
|
A "swap" insn looks like a parallel of two patterns, where each
|
|
|
|
|
pattern is a SET: one sets A to B, the other B to A.
|
|
|
|
|
|
|
|
|
|
A "push" or "load" insn is a SET whose SET_DEST is FIRST_STACK_REG
|
|
|
|
|
and whose SET_DEST is REG or MEM. Any other SET_DEST, such as PLUS,
|
|
|
|
|
will replace the existing stack top, not push a new value.
|
|
|
|
|
|
|
|
|
|
A store insn is a SET whose SET_DEST is FIRST_STACK_REG, and whose
|
|
|
|
|
SET_SRC is REG or MEM.
|
|
|
|
|
|
1992-03-21 05:53:32 +01:00
|
|
|
|
The case where the SET_SRC and SET_DEST are both FIRST_STACK_REG
|
1991-12-26 11:05:42 +01:00
|
|
|
|
appears ambiguous. As a special case, the presence of a REG_DEAD note
|
|
|
|
|
for FIRST_STACK_REG differentiates between a load insn and a pop.
|
|
|
|
|
|
|
|
|
|
If a REG_DEAD is present, the insn represents a "pop" that discards
|
|
|
|
|
the top of the register stack. If there is no REG_DEAD note, then the
|
|
|
|
|
insn represents a "dup" or a push of the current top of stack onto the
|
|
|
|
|
stack.
|
|
|
|
|
|
|
|
|
|
* Methodology:
|
|
|
|
|
|
|
|
|
|
Existing REG_DEAD and REG_UNUSED notes for stack registers are
|
|
|
|
|
deleted and recreated from scratch. REG_DEAD is never created for a
|
|
|
|
|
SET_DEST, only REG_UNUSED.
|
|
|
|
|
|
1992-01-19 05:23:39 +01:00
|
|
|
|
* asm_operands:
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1992-01-19 05:23:39 +01:00
|
|
|
|
There are several rules on the usage of stack-like regs in
|
|
|
|
|
asm_operands insns. These rules apply only to the operands that are
|
|
|
|
|
stack-like regs:
|
|
|
|
|
|
|
|
|
|
1. Given a set of input regs that die in an asm_operands, it is
|
|
|
|
|
necessary to know which are implicitly popped by the asm, and
|
|
|
|
|
which must be explicitly popped by gcc.
|
|
|
|
|
|
|
|
|
|
An input reg that is implicitly popped by the asm must be
|
|
|
|
|
explicitly clobbered, unless it is constrained to match an
|
|
|
|
|
output operand.
|
|
|
|
|
|
|
|
|
|
2. For any input reg that is implicitly popped by an asm, it is
|
|
|
|
|
necessary to know how to adjust the stack to compensate for the pop.
|
|
|
|
|
If any non-popped input is closer to the top of the reg-stack than
|
|
|
|
|
the implicitly popped reg, it would not be possible to know what the
|
|
|
|
|
stack looked like - it's not clear how the rest of the stack "slides
|
|
|
|
|
up".
|
|
|
|
|
|
|
|
|
|
All implicitly popped input regs must be closer to the top of
|
|
|
|
|
the reg-stack than any input that is not implicitly popped.
|
|
|
|
|
|
|
|
|
|
3. It is possible that if an input dies in an insn, reload might
|
|
|
|
|
use the input reg for an output reload. Consider this example:
|
|
|
|
|
|
|
|
|
|
asm ("foo" : "=t" (a) : "f" (b));
|
|
|
|
|
|
|
|
|
|
This asm says that input B is not popped by the asm, and that
|
|
|
|
|
the asm pushes a result onto the reg-stack, ie, the stack is one
|
|
|
|
|
deeper after the asm than it was before. But, it is possible that
|
|
|
|
|
reload will think that it can use the same reg for both the input and
|
|
|
|
|
the output, if input B dies in this insn.
|
|
|
|
|
|
|
|
|
|
If any input operand uses the "f" constraint, all output reg
|
|
|
|
|
constraints must use the "&" earlyclobber.
|
|
|
|
|
|
|
|
|
|
The asm above would be written as
|
|
|
|
|
|
|
|
|
|
asm ("foo" : "=&t" (a) : "f" (b));
|
|
|
|
|
|
|
|
|
|
4. Some operands need to be in particular places on the stack. All
|
|
|
|
|
output operands fall in this category - there is no other way to
|
|
|
|
|
know which regs the outputs appear in unless the user indicates
|
|
|
|
|
this in the constraints.
|
|
|
|
|
|
|
|
|
|
Output operands must specifically indicate which reg an output
|
|
|
|
|
appears in after an asm. "=f" is not allowed: the operand
|
|
|
|
|
constraints must select a class with a single reg.
|
|
|
|
|
|
|
|
|
|
5. Output operands may not be "inserted" between existing stack regs.
|
|
|
|
|
Since no 387 opcode uses a read/write operand, all output operands
|
|
|
|
|
are dead before the asm_operands, and are pushed by the asm_operands.
|
|
|
|
|
It makes no sense to push anywhere but the top of the reg-stack.
|
|
|
|
|
|
|
|
|
|
Output operands must start at the top of the reg-stack: output
|
|
|
|
|
operands may not "skip" a reg.
|
|
|
|
|
|
|
|
|
|
6. Some asm statements may need extra stack space for internal
|
|
|
|
|
calculations. This can be guaranteed by clobbering stack registers
|
|
|
|
|
unrelated to the inputs and outputs.
|
|
|
|
|
|
|
|
|
|
Here are a couple of reasonable asms to want to write. This asm
|
|
|
|
|
takes one input, which is internally popped, and produces two outputs.
|
|
|
|
|
|
|
|
|
|
asm ("fsincos" : "=t" (cos), "=u" (sin) : "0" (inp));
|
|
|
|
|
|
|
|
|
|
This asm takes two inputs, which are popped by the fyl2xp1 opcode,
|
|
|
|
|
and replaces them with one output. The user must code the "st(1)"
|
|
|
|
|
clobber for reg-stack.c to know that fyl2xp1 pops both inputs.
|
|
|
|
|
|
|
|
|
|
asm ("fyl2xp1" : "=t" (result) : "0" (x), "u" (y) : "st(1)");
|
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
*/
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
#include "config.h"
|
Major cutover to using system.h:
* Makefile.in (alias.o, bitmap.o, c-aux-info.o, c-common.o,
c-decl.o, c-iterate.o, c-lang.o, c-lex.o, c-pragma.o, c-typeck.o,
caller-save.o, calls.o, collect2.o, combine.o, cse.o, dbxout.o,
dwarf2out.o, dwarfout.o, emit-rtl.o, except.o, explow.o, expmed.o,
expr.o, final.o, flow.o, function.o, getpwd.o, global.o,
integrate.o, jump.o, local-alloc.o, loop.o, optabs.o, pexecute.o,
prefix.o, print-rtl.o, print-tree.o, profile.o, real.o, recog.o,
reg-stack.o, regclass.o, regmove.o, reload.o, reload1.o, reorg.o,
rtl.o, rtlanal.o, sdbout.o, stmt.o, stor-layout.o, stupid.o,
tlink.o, toplev.o, tree.o, unroll.o, varasm.o, xcoffout.o): Depend
on system.h.
* alias.c, bitmap.c, c-aux-info.c, c-common.c, c-decl.c,
c-iterate.c, c-lang.c, c-lex.c, c-pragma.c, c-typeck.c,
caller-save.c, calls.c, collect2.c, combine.c, cse.c, dbxout.c,
dwarf2out.c, dwarfout.c, emit-rtl.c, except.c, explow.c, expmed.c,
expr.c, final.c, flow.c, function.c, gcc.c, getpwd.c, global.c,
integrate.c, jump.c, local-alloc.c, loop.c, optabs.c, pexecute.c,
prefix.c, print-rtl.c, print-tree.c, profile.c, real.c, recog.c,
reg-stack.c, regclass.c, regmove.c, reload.c, reload1.c, reorg.c,
rtl.c, rtlanal.c, sched.c, sdbout.c, stmt.c, stor-layout.c,
stupid.c, tlink.c, toplev.c, tree.c, unroll.c, varasm.c,
xcoffout.c: Include system.h. Organize include ordering so
that stdarg/varargs comes before other system headers. Remove
spurious casts of functions assured of a prototype in system.h.
From-SVN: r18726
1998-03-20 15:58:42 +01:00
|
|
|
|
#include "system.h"
|
1991-12-26 11:05:42 +01:00
|
|
|
|
#include "tree.h"
|
|
|
|
|
#include "rtl.h"
|
1999-09-20 12:00:03 +02:00
|
|
|
|
#include "tm_p.h"
|
1999-08-09 16:00:21 +02:00
|
|
|
|
#include "function.h"
|
1992-01-19 05:23:39 +01:00
|
|
|
|
#include "insn-config.h"
|
1991-12-26 11:05:42 +01:00
|
|
|
|
#include "regs.h"
|
|
|
|
|
#include "hard-reg-set.h"
|
|
|
|
|
#include "flags.h"
|
toplev.h: New file.
Wed May 6 06:35:38 1998 Robert Lipe <robertl@dgii.com>
* toplev.h: New file. Protypes for functions in toplev.c.
* tree.h, rtl.h: Deleted protos for functions in toplev.c.
* c-common.c, c-convert.c, c-decl.c, c-iterate.c, c-lex.c,
c-parse.in, c-parse.y, c-pragma.c, c-typeck.c, calls.c,
convert.c, dwarf2out.c, except.c, expr.c, final.c, fold-const.c,
function.c, hash.c, profile.c, real.c, reg-stack.c, regclass.c,
reload.c, reload1.c, stmt.c, stor-layout.c, tlink.c, tree.c,
varasm.c: include it.
From-SVN: r19564
1998-05-06 06:54:01 +02:00
|
|
|
|
#include "toplev.h"
|
1999-09-02 06:20:21 +02:00
|
|
|
|
#include "recog.h"
|
1999-10-27 03:25:13 +02:00
|
|
|
|
#include "output.h"
|
|
|
|
|
#include "basic-block.h"
|
1999-04-12 03:39:00 +02:00
|
|
|
|
#include "varray.h"
|
2001-04-13 23:10:16 +02:00
|
|
|
|
#include "reload.h"
|
2002-06-04 09:11:05 +02:00
|
|
|
|
#include "ggc.h"
|
|
|
|
|
|
|
|
|
|
/* We use this array to cache info about insns, because otherwise we
|
|
|
|
|
spend too much time in stack_regs_mentioned_p.
|
|
|
|
|
|
|
|
|
|
Indexed by insn UIDs. A value of zero is uninitialized, one indicates
|
|
|
|
|
the insn uses stack registers, two indicates the insn does not use
|
|
|
|
|
stack registers. */
|
|
|
|
|
static GTY(()) varray_type stack_regs_mentioned_data;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
#ifdef STACK_REGS
|
|
|
|
|
|
|
|
|
|
#define REG_STACK_SIZE (LAST_STACK_REG - FIRST_STACK_REG + 1)
|
|
|
|
|
|
|
|
|
|
/* This is the basic stack record. TOP is an index into REG[] such
|
|
|
|
|
that REG[TOP] is the top of stack. If TOP is -1 the stack is empty.
|
|
|
|
|
|
1993-01-20 07:39:06 +01:00
|
|
|
|
If TOP is -2, REG[] is not yet initialized. Stack initialization
|
|
|
|
|
consists of placing each live reg in array `reg' and setting `top'
|
|
|
|
|
appropriately.
|
|
|
|
|
|
|
|
|
|
REG_SET indicates which registers are live. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
typedef struct stack_def
|
|
|
|
|
{
|
|
|
|
|
int top; /* index to top stack element */
|
|
|
|
|
HARD_REG_SET reg_set; /* set of live registers */
|
2001-02-17 10:55:46 +01:00
|
|
|
|
unsigned char reg[REG_STACK_SIZE];/* register - stack mapping */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
} *stack;
|
|
|
|
|
|
2002-05-09 03:42:28 +02:00
|
|
|
|
/* This is used to carry information about basic blocks. It is
|
1999-10-27 03:25:13 +02:00
|
|
|
|
attached to the AUX field of the standard CFG block. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
typedef struct block_info_def
|
|
|
|
|
{
|
|
|
|
|
struct stack_def stack_in; /* Input stack configuration. */
|
2001-07-30 22:30:23 +02:00
|
|
|
|
struct stack_def stack_out; /* Output stack configuration. */
|
1999-10-27 03:25:13 +02:00
|
|
|
|
HARD_REG_SET out_reg_set; /* Stack regs live on output. */
|
|
|
|
|
int done; /* True if block already converted. */
|
2001-11-23 02:37:07 +01:00
|
|
|
|
int predecessors; /* Number of predecessors that needs
|
2001-07-30 22:30:23 +02:00
|
|
|
|
to be visited. */
|
1999-10-27 03:25:13 +02:00
|
|
|
|
} *block_info;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
#define BLOCK_INFO(B) ((block_info) (B)->aux)
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* Passed to change_stack to indicate where to emit insns. */
|
|
|
|
|
enum emit_where
|
|
|
|
|
{
|
|
|
|
|
EMIT_AFTER,
|
|
|
|
|
EMIT_BEFORE
|
|
|
|
|
};
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* The block we're currently working on. */
|
|
|
|
|
static basic_block current_block;
|
|
|
|
|
|
1991-12-26 11:05:42 +01:00
|
|
|
|
/* This is the register file for all register after conversion */
|
1995-04-26 01:06:57 +02:00
|
|
|
|
static rtx
|
|
|
|
|
FP_mode_reg[LAST_STACK_REG+1-FIRST_STACK_REG][(int) MAX_MACHINE_MODE];
|
|
|
|
|
|
|
|
|
|
#define FP_MODE_REG(regno,mode) \
|
2002-01-10 01:56:56 +01:00
|
|
|
|
(FP_mode_reg[(regno)-FIRST_STACK_REG][(int) (mode)])
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* Used to initialize uninitialized registers. */
|
|
|
|
|
static rtx nan;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
/* Forward declarations */
|
|
|
|
|
|
2000-01-17 17:01:04 +01:00
|
|
|
|
static int stack_regs_mentioned_p PARAMS ((rtx pat));
|
|
|
|
|
static void straighten_stack PARAMS ((rtx, stack));
|
|
|
|
|
static void pop_stack PARAMS ((stack, int));
|
|
|
|
|
static rtx *get_true_reg PARAMS ((rtx *));
|
|
|
|
|
|
|
|
|
|
static int check_asm_stack_operands PARAMS ((rtx));
|
|
|
|
|
static int get_asm_operand_n_inputs PARAMS ((rtx));
|
|
|
|
|
static rtx stack_result PARAMS ((tree));
|
|
|
|
|
static void replace_reg PARAMS ((rtx *, int));
|
2001-02-17 10:55:46 +01:00
|
|
|
|
static void remove_regno_note PARAMS ((rtx, enum reg_note,
|
|
|
|
|
unsigned int));
|
2000-01-17 17:01:04 +01:00
|
|
|
|
static int get_hard_regnum PARAMS ((stack, rtx));
|
|
|
|
|
static rtx emit_pop_insn PARAMS ((rtx, stack, rtx,
|
1999-10-27 03:25:13 +02:00
|
|
|
|
enum emit_where));
|
2000-01-17 17:01:04 +01:00
|
|
|
|
static void emit_swap_insn PARAMS ((rtx, stack, rtx));
|
|
|
|
|
static void move_for_stack_reg PARAMS ((rtx, stack, rtx));
|
|
|
|
|
static int swap_rtx_condition_1 PARAMS ((rtx));
|
|
|
|
|
static int swap_rtx_condition PARAMS ((rtx));
|
|
|
|
|
static void compare_for_stack_reg PARAMS ((rtx, stack, rtx));
|
|
|
|
|
static void subst_stack_regs_pat PARAMS ((rtx, stack, rtx));
|
|
|
|
|
static void subst_asm_stack_regs PARAMS ((rtx, stack));
|
|
|
|
|
static void subst_stack_regs PARAMS ((rtx, stack));
|
|
|
|
|
static void change_stack PARAMS ((rtx, stack, stack,
|
1999-10-27 03:25:13 +02:00
|
|
|
|
enum emit_where));
|
2000-01-17 17:01:04 +01:00
|
|
|
|
static int convert_regs_entry PARAMS ((void));
|
|
|
|
|
static void convert_regs_exit PARAMS ((void));
|
|
|
|
|
static int convert_regs_1 PARAMS ((FILE *, basic_block));
|
|
|
|
|
static int convert_regs_2 PARAMS ((FILE *, basic_block));
|
|
|
|
|
static int convert_regs PARAMS ((FILE *));
|
|
|
|
|
static void print_stack PARAMS ((FILE *, stack));
|
Makefile.in (c-common.o): Depend on $(EXPR_H).
* Makefile.in (c-common.o): Depend on $(EXPR_H).
* c-common.c: Include expr.h.
* c-pragma.c (mark_align_stack): Add prototype.
* caller-save.c (add_stored_regs): Likewise.
* combine.c (record_promoted_value): Likewise.
* i386.c (ix86_sched_reorder_pentium, ix86_sched_reorder_ppro):
Likewise.
* cppinit.c (new_pending_define): Likewise.
* cpplib.c (skip_block_comment, skip_line_comment): Likewise.
* dwarf2out.c (save_rtx, splice_child_die, reverse_die_lists,
AT_class, AT_flag, AT_int, AT_unsigned, AT_string, AT_ref, AT_loc,
AT_addr, AT_lbl, get_AT_ref, free_AT, free_die, local_scope_p,
class_scope_p): Likewise.
* dwarf2out.h (dwarf2out_set_demangle_name_func,
dwarf2out_add_library_unit_info): Likewise.
* ggc.h (ggc_page_print_statistics): Likewise.
* haifa-sched.c (propagate_deps): Likewise.
* reg-stack.c (next_flags_user, record_label_references): Likewise.
* rtl.h (set_stack_check_libfunc): Likewise.
* toplev.h (set_fatal_function): Likewise.
* toplev.c (set_fatal_function): Delete prototype.
* diagnostic.c: Deconstify functions returning malloc'ed ptrs.
From-SVN: r31810
2000-02-06 04:40:46 +01:00
|
|
|
|
static rtx next_flags_user PARAMS ((rtx));
|
|
|
|
|
static void record_label_references PARAMS ((rtx, rtx));
|
2001-07-30 22:30:23 +02:00
|
|
|
|
static bool compensate_edge PARAMS ((edge, FILE *));
|
1999-04-12 03:39:00 +02:00
|
|
|
|
|
1999-09-02 06:20:21 +02:00
|
|
|
|
/* Return non-zero if any stack register is mentioned somewhere within PAT. */
|
1999-04-12 03:39:00 +02:00
|
|
|
|
|
|
|
|
|
static int
|
1999-09-02 06:20:21 +02:00
|
|
|
|
stack_regs_mentioned_p (pat)
|
|
|
|
|
rtx pat;
|
1999-04-12 03:39:00 +02:00
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
const char *fmt;
|
|
|
|
|
int i;
|
1999-09-02 06:20:21 +02:00
|
|
|
|
|
|
|
|
|
if (STACK_REG_P (pat))
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
fmt = GET_RTX_FORMAT (GET_CODE (pat));
|
|
|
|
|
for (i = GET_RTX_LENGTH (GET_CODE (pat)) - 1; i >= 0; i--)
|
1999-04-12 03:39:00 +02:00
|
|
|
|
{
|
1999-09-02 06:20:21 +02:00
|
|
|
|
if (fmt[i] == 'E')
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
int j;
|
1999-09-02 06:20:21 +02:00
|
|
|
|
|
|
|
|
|
for (j = XVECLEN (pat, i) - 1; j >= 0; j--)
|
|
|
|
|
if (stack_regs_mentioned_p (XVECEXP (pat, i, j)))
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
else if (fmt[i] == 'e' && stack_regs_mentioned_p (XEXP (pat, i)))
|
|
|
|
|
return 1;
|
1999-04-12 03:39:00 +02:00
|
|
|
|
}
|
1999-09-02 06:20:21 +02:00
|
|
|
|
|
1999-04-12 03:39:00 +02:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
1999-09-02 06:20:21 +02:00
|
|
|
|
/* Return nonzero if INSN mentions stacked registers, else return zero. */
|
1999-04-12 03:39:00 +02:00
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
stack_regs_mentioned (insn)
|
|
|
|
|
rtx insn;
|
|
|
|
|
{
|
1999-09-02 06:20:21 +02:00
|
|
|
|
unsigned int uid, max;
|
|
|
|
|
int test;
|
|
|
|
|
|
2001-07-16 22:54:44 +02:00
|
|
|
|
if (! INSN_P (insn) || !stack_regs_mentioned_data)
|
1999-04-12 03:39:00 +02:00
|
|
|
|
return 0;
|
1999-09-02 06:20:21 +02:00
|
|
|
|
|
1999-04-12 03:39:00 +02:00
|
|
|
|
uid = INSN_UID (insn);
|
1999-09-02 06:20:21 +02:00
|
|
|
|
max = VARRAY_SIZE (stack_regs_mentioned_data);
|
|
|
|
|
if (uid >= max)
|
|
|
|
|
{
|
|
|
|
|
/* Allocate some extra size to avoid too many reallocs, but
|
|
|
|
|
do not grow too quickly. */
|
|
|
|
|
max = uid + uid / 20;
|
|
|
|
|
VARRAY_GROW (stack_regs_mentioned_data, max);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
test = VARRAY_CHAR (stack_regs_mentioned_data, uid);
|
|
|
|
|
if (test == 0)
|
|
|
|
|
{
|
|
|
|
|
/* This insn has yet to be examined. Do so now. */
|
|
|
|
|
test = stack_regs_mentioned_p (PATTERN (insn)) ? 1 : 2;
|
|
|
|
|
VARRAY_CHAR (stack_regs_mentioned_data, uid) = test;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return test == 1;
|
1999-04-12 03:39:00 +02:00
|
|
|
|
}
|
1999-09-02 06:20:21 +02:00
|
|
|
|
|
|
|
|
|
static rtx ix86_flags_rtx;
|
1999-04-12 03:39:00 +02:00
|
|
|
|
|
1999-09-02 06:20:21 +02:00
|
|
|
|
static rtx
|
|
|
|
|
next_flags_user (insn)
|
|
|
|
|
rtx insn;
|
|
|
|
|
{
|
2002-05-09 03:42:28 +02:00
|
|
|
|
/* Search forward looking for the first use of this value.
|
1999-09-02 06:20:21 +02:00
|
|
|
|
Stop at block boundaries. */
|
|
|
|
|
|
2001-02-19 15:59:42 +01:00
|
|
|
|
while (insn != current_block->end)
|
1999-09-02 06:20:21 +02:00
|
|
|
|
{
|
|
|
|
|
insn = NEXT_INSN (insn);
|
|
|
|
|
|
2000-08-04 22:28:08 +02:00
|
|
|
|
if (INSN_P (insn) && reg_mentioned_p (ix86_flags_rtx, PATTERN (insn)))
|
2002-05-09 03:42:28 +02:00
|
|
|
|
return insn;
|
1999-09-02 06:20:21 +02:00
|
|
|
|
|
2001-02-19 15:59:42 +01:00
|
|
|
|
if (GET_CODE (insn) == CALL_INSN)
|
1999-09-02 06:20:21 +02:00
|
|
|
|
return NULL_RTX;
|
|
|
|
|
}
|
2001-02-19 15:59:42 +01:00
|
|
|
|
return NULL_RTX;
|
1999-09-02 06:20:21 +02:00
|
|
|
|
}
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1995-04-26 01:06:57 +02:00
|
|
|
|
/* Reorganise the stack into ascending numbers,
|
|
|
|
|
after this insn. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
straighten_stack (insn, regstack)
|
|
|
|
|
rtx insn;
|
|
|
|
|
stack regstack;
|
|
|
|
|
{
|
|
|
|
|
struct stack_def temp_stack;
|
|
|
|
|
int top;
|
|
|
|
|
|
1998-09-10 03:03:02 +02:00
|
|
|
|
/* If there is only a single register on the stack, then the stack is
|
|
|
|
|
already in increasing order and no reorganization is needed.
|
|
|
|
|
|
|
|
|
|
Similarly if the stack is empty. */
|
|
|
|
|
if (regstack->top <= 0)
|
|
|
|
|
return;
|
|
|
|
|
|
1999-09-28 15:43:34 +02:00
|
|
|
|
COPY_HARD_REG_SET (temp_stack.reg_set, regstack->reg_set);
|
1995-04-26 01:06:57 +02:00
|
|
|
|
|
|
|
|
|
for (top = temp_stack.top = regstack->top; top >= 0; top--)
|
1999-09-02 06:20:21 +02:00
|
|
|
|
temp_stack.reg[top] = FIRST_STACK_REG + temp_stack.top - top;
|
2002-05-09 03:42:28 +02:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
change_stack (insn, regstack, &temp_stack, EMIT_AFTER);
|
1995-04-26 01:06:57 +02:00
|
|
|
|
}
|
1998-03-20 09:28:06 +01:00
|
|
|
|
|
|
|
|
|
/* Pop a register from the stack */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
pop_stack (regstack, regno)
|
|
|
|
|
stack regstack;
|
|
|
|
|
int regno;
|
|
|
|
|
{
|
|
|
|
|
int top = regstack->top;
|
|
|
|
|
|
|
|
|
|
CLEAR_HARD_REG_BIT (regstack->reg_set, regno);
|
|
|
|
|
regstack->top--;
|
|
|
|
|
/* If regno was not at the top of stack then adjust stack */
|
|
|
|
|
if (regstack->reg [top] != regno)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
for (i = regstack->top; i >= 0; i--)
|
|
|
|
|
if (regstack->reg [i] == regno)
|
|
|
|
|
{
|
|
|
|
|
int j;
|
|
|
|
|
for (j = i; j < top; j++)
|
|
|
|
|
regstack->reg [j] = regstack->reg [j + 1];
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
1995-04-26 01:06:57 +02:00
|
|
|
|
|
1991-12-26 11:05:42 +01:00
|
|
|
|
/* Convert register usage from "flat" register file usage to a "stack
|
|
|
|
|
register file. FIRST is the first insn in the function, FILE is the
|
|
|
|
|
dump file, if used.
|
|
|
|
|
|
1999-10-28 00:22:34 +02:00
|
|
|
|
Construct a CFG and run life analysis. Then convert each insn one
|
jump.c: Update comments.
* jump.c: Update comments.
(delete_barrier_successors, delete_unreferenced_labels,
delete_noop_moves, tension_vector_labels, delete_from_jump_chain,
delete_labelref_insn, redirect_tablejump, jump_optimize_1,
jump_optimize, jump_optimize_minimal): Kill.
(rebuild_jump_labels): Move code from jump_optimize_1.
(purge_line_number_notes): Likewise.
(copy_loop_headers): Likewise.
* reg-stack.c: Update comment.
* stmt.c: Likewise.
* rtl.h (jump_optimize, jump_optimize_1, JUMP_NOOP_MOVES,
JUMP_AFTER_REGSCAN): Kill.
* toplev.c (rest_of_compilation): Use cleanup_cfg, call
purge_line_number_notes and copy_loop_headers.
From-SVN: r44245
2001-07-22 21:34:13 +02:00
|
|
|
|
by one. Run a last cleanup_cfg pass, if optimizing, to eliminate
|
1999-10-27 03:25:13 +02:00
|
|
|
|
code duplication created when the converter inserts pop insns on
|
|
|
|
|
the edges. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
reg_to_stack (first, file)
|
|
|
|
|
rtx first;
|
|
|
|
|
FILE *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
|
|
|
|
basic_block bb;
|
2002-05-17 04:31:56 +02:00
|
|
|
|
int i;
|
|
|
|
|
int max_uid;
|
1999-10-27 03:25:13 +02:00
|
|
|
|
|
2001-07-16 22:54:44 +02:00
|
|
|
|
/* Clean up previous run. */
|
2002-06-04 09:11:05 +02:00
|
|
|
|
stack_regs_mentioned_data = 0;
|
2001-07-16 22:54:44 +02:00
|
|
|
|
|
2001-07-15 00:52:50 +02:00
|
|
|
|
if (!optimize)
|
|
|
|
|
split_all_insns (0);
|
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* See if there is something to do. Flow analysis is quite
|
|
|
|
|
expensive so we might save some compilation time. */
|
|
|
|
|
for (i = FIRST_STACK_REG; i <= LAST_STACK_REG; i++)
|
|
|
|
|
if (regs_ever_live[i])
|
|
|
|
|
break;
|
|
|
|
|
if (i > LAST_STACK_REG)
|
|
|
|
|
return;
|
1995-04-26 01:06:57 +02:00
|
|
|
|
|
2002-05-09 03:42:28 +02:00
|
|
|
|
/* Ok, floating point instructions exist. If not optimizing,
|
1999-10-28 00:22:34 +02:00
|
|
|
|
build the CFG and run life analysis. */
|
2001-07-15 00:52:50 +02:00
|
|
|
|
if (!optimize)
|
2001-10-30 12:13:49 +01:00
|
|
|
|
{
|
|
|
|
|
count_or_remove_death_notes (NULL, 1);
|
|
|
|
|
life_analysis (first, file, PROP_DEATH_NOTES);
|
|
|
|
|
}
|
2001-07-30 22:30:23 +02:00
|
|
|
|
mark_dfs_back_edges ();
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* Set up block info for each basic block. */
|
Makefile.in (cfgrtl.o): Add.
* Makefile.in (cfgrtl.o): Add.
* basic-block.h (alloc_block, alloc_aux_for_block, alloc_aux_for_blocks,
free_aux_for_block, alloc_aux_for_edge, alloc_aux_for_edges,
free_aux_for_edge): Declare.
* cfg.c
(HAVE_return): Undefine.
* basic-block.h (alloc_block, alloc_aux_for_block, alloc_aux_for_blocks,
free_aux_for_block, alloc_aux_for_edge, alloc_aux_for_edges,
free_aux_for_edge): New global functions.
(first_delete_block): New static variable.
(init_flow): Clear first_delete_block.
(basic_block_for_insn, label_value_list, tail_recursion_label_list,
can_delete_note_p, can_delete_label_p, commit_one_edge_insertion,
try_redirect_by_replacing_jump, last_loop_beg_note,
back_edge_of_syntactic_loop_p, force_nonfallthru_and_redirect,
delete_insn, delete_insn_chain, create_basic_block_structure,
create_basic_block, flow_delete_block, compute_bb_for_insn,
free_bb_for_insn, update_bb_for_insn, set_block_for_insn,
set_block_for_new_insns, split_block, merge_blocks_nomove,
block_label, try_redirect_by_replacing_jump, last_loop_beg_note,
redirect_edge_and_branch, force_nonfallthru_and_redirect,
force_nonfallthru, redirect_edge_and_branch_force, tidy_fallthru_edge,
tidy_fallthru_edges, split_edge, insert_insn_on_edge,
commit_one_edge_insertion, commit_edge_insertions, dump_bb, debug_bb,
debug_bb_n, print_rtl_with_bb, verify_flow_info, purge_dead_edges,
purge_all_dead_edges): Move to ....
* cfgrtl.c: New file; .... Here.
* bb-reorder.c (fixup_reorder_chain): Use alloc_aux_for_block.
(reroder_basic_block): Use alloc_aux_for_blocks.
* predict.c (estimate_bb_frequencies): Likewise; use
alloc_aux_for_edges.
* profile.c (compute_branch_probabilities): Likewise.
(branch_prob): Likewise.
* reg-stack.c (reg_to_stack): Likewise.
* emit-rtl.c (emit_insns_after): Never return NULL.
* basic-block.h (set_block_for_new_insns): Delete.
* cfgrtl.c (set_block_for_new_insns): Delete.
* cfgcleanup.c (try_optimize_cfg): Add fake exit edges for noreturn
calls when crossjumping.
* cfgcleanup.c (try_simplify_condjump): Cleanup invert_jump call.
* unroll.c (copy_loop_body): Use delete_insn.
* final.c (final, final_scan_insn): Use delete_insn/delete_note.
* function.c (fixup_var_refs_insn, fixup_var_refs_1,
keep_stack_depressed): Likewise.
* gcse.c (cprop_cc0_jump): Likewise.
* local-alloc.c (update_equiv_regs): Likewise.
* loop.c (scan_loop, loop_delete_insns): Likewise.
* regmove.c (try_auto_increment, fixup_match_1): Likewise.
* reload1.c (reload, calculate_needs_all_insns, reload_as_needed,
delete_output_reload, delete_address_reloads_1,
reload_cse_delete_noop_set, reload_combine, reload_cse_move2add):
Likewise.
* sibcall.c (replace_call_placeholder): Likewise.
* cse.c (cse_insn): Likewise.
From-SVN: r45807
2001-09-25 17:26:55 +02:00
|
|
|
|
alloc_aux_for_blocks (sizeof (struct block_info_def));
|
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 (bb)
|
2001-07-30 22:30:23 +02:00
|
|
|
|
{
|
|
|
|
|
edge e;
|
|
|
|
|
for (e = bb->pred; e; e=e->pred_next)
|
|
|
|
|
if (!(e->flags & EDGE_DFS_BACK)
|
|
|
|
|
&& e->src != ENTRY_BLOCK_PTR)
|
2001-11-23 02:37:07 +01:00
|
|
|
|
BLOCK_INFO (bb)->predecessors++;
|
2001-07-30 22:30:23 +02:00
|
|
|
|
}
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* Create the replacement registers up front. */
|
|
|
|
|
for (i = FIRST_STACK_REG; i <= LAST_STACK_REG; i++)
|
1999-04-12 03:39:00 +02:00
|
|
|
|
{
|
1999-10-27 03:25:13 +02:00
|
|
|
|
enum machine_mode mode;
|
|
|
|
|
for (mode = GET_CLASS_NARROWEST_MODE (MODE_FLOAT);
|
|
|
|
|
mode != VOIDmode;
|
|
|
|
|
mode = GET_MODE_WIDER_MODE (mode))
|
|
|
|
|
FP_MODE_REG (i, mode) = gen_rtx_REG (mode, i);
|
|
|
|
|
for (mode = GET_CLASS_NARROWEST_MODE (MODE_COMPLEX_FLOAT);
|
|
|
|
|
mode != VOIDmode;
|
|
|
|
|
mode = GET_MODE_WIDER_MODE (mode))
|
|
|
|
|
FP_MODE_REG (i, mode) = gen_rtx_REG (mode, i);
|
1999-04-12 03:39:00 +02:00
|
|
|
|
}
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
ix86_flags_rtx = gen_rtx_REG (CCmode, FLAGS_REG);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
2002-05-09 03:42:28 +02:00
|
|
|
|
/* A QNaN for initializing uninitialized variables.
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
??? We can't load from constant memory in PIC mode, because
|
|
|
|
|
we're insertting these instructions before the prologue and
|
|
|
|
|
the PIC register hasn't been set up. In that case, fall back
|
|
|
|
|
on zero, which we can get from `ldz'. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
if (flag_pic)
|
|
|
|
|
nan = CONST0_RTX (SFmode);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
nan = gen_lowpart (SFmode, GEN_INT (0x7fc00000));
|
|
|
|
|
nan = force_const_mem (SFmode, nan);
|
|
|
|
|
}
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* Allocate a cache for stack_regs_mentioned. */
|
|
|
|
|
max_uid = get_max_uid ();
|
|
|
|
|
VARRAY_CHAR_INIT (stack_regs_mentioned_data, max_uid + 1,
|
|
|
|
|
"stack_regs_mentioned cache");
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
2001-07-16 22:54:44 +02:00
|
|
|
|
convert_regs (file);
|
1999-04-12 03:39:00 +02:00
|
|
|
|
|
Makefile.in (cfgrtl.o): Add.
* Makefile.in (cfgrtl.o): Add.
* basic-block.h (alloc_block, alloc_aux_for_block, alloc_aux_for_blocks,
free_aux_for_block, alloc_aux_for_edge, alloc_aux_for_edges,
free_aux_for_edge): Declare.
* cfg.c
(HAVE_return): Undefine.
* basic-block.h (alloc_block, alloc_aux_for_block, alloc_aux_for_blocks,
free_aux_for_block, alloc_aux_for_edge, alloc_aux_for_edges,
free_aux_for_edge): New global functions.
(first_delete_block): New static variable.
(init_flow): Clear first_delete_block.
(basic_block_for_insn, label_value_list, tail_recursion_label_list,
can_delete_note_p, can_delete_label_p, commit_one_edge_insertion,
try_redirect_by_replacing_jump, last_loop_beg_note,
back_edge_of_syntactic_loop_p, force_nonfallthru_and_redirect,
delete_insn, delete_insn_chain, create_basic_block_structure,
create_basic_block, flow_delete_block, compute_bb_for_insn,
free_bb_for_insn, update_bb_for_insn, set_block_for_insn,
set_block_for_new_insns, split_block, merge_blocks_nomove,
block_label, try_redirect_by_replacing_jump, last_loop_beg_note,
redirect_edge_and_branch, force_nonfallthru_and_redirect,
force_nonfallthru, redirect_edge_and_branch_force, tidy_fallthru_edge,
tidy_fallthru_edges, split_edge, insert_insn_on_edge,
commit_one_edge_insertion, commit_edge_insertions, dump_bb, debug_bb,
debug_bb_n, print_rtl_with_bb, verify_flow_info, purge_dead_edges,
purge_all_dead_edges): Move to ....
* cfgrtl.c: New file; .... Here.
* bb-reorder.c (fixup_reorder_chain): Use alloc_aux_for_block.
(reroder_basic_block): Use alloc_aux_for_blocks.
* predict.c (estimate_bb_frequencies): Likewise; use
alloc_aux_for_edges.
* profile.c (compute_branch_probabilities): Likewise.
(branch_prob): Likewise.
* reg-stack.c (reg_to_stack): Likewise.
* emit-rtl.c (emit_insns_after): Never return NULL.
* basic-block.h (set_block_for_new_insns): Delete.
* cfgrtl.c (set_block_for_new_insns): Delete.
* cfgcleanup.c (try_optimize_cfg): Add fake exit edges for noreturn
calls when crossjumping.
* cfgcleanup.c (try_simplify_condjump): Cleanup invert_jump call.
* unroll.c (copy_loop_body): Use delete_insn.
* final.c (final, final_scan_insn): Use delete_insn/delete_note.
* function.c (fixup_var_refs_insn, fixup_var_refs_1,
keep_stack_depressed): Likewise.
* gcse.c (cprop_cc0_jump): Likewise.
* local-alloc.c (update_equiv_regs): Likewise.
* loop.c (scan_loop, loop_delete_insns): Likewise.
* regmove.c (try_auto_increment, fixup_match_1): Likewise.
* reload1.c (reload, calculate_needs_all_insns, reload_as_needed,
delete_output_reload, delete_address_reloads_1,
reload_cse_delete_noop_set, reload_combine, reload_cse_move2add):
Likewise.
* sibcall.c (replace_call_placeholder): Likewise.
* cse.c (cse_insn): Likewise.
From-SVN: r45807
2001-09-25 17:26:55 +02:00
|
|
|
|
free_aux_for_blocks ();
|
1991-12-26 11:05:42 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Check PAT, which is in INSN, for LABEL_REFs. Add INSN to the
|
|
|
|
|
label's chain of references, and note which insn contains each
|
1996-07-04 00:07:53 +02:00
|
|
|
|
reference. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
record_label_references (insn, pat)
|
|
|
|
|
rtx insn, pat;
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
enum rtx_code code = GET_CODE (pat);
|
|
|
|
|
int i;
|
|
|
|
|
const char *fmt;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
if (code == LABEL_REF)
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
rtx label = XEXP (pat, 0);
|
|
|
|
|
rtx ref;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
if (GET_CODE (label) != CODE_LABEL)
|
|
|
|
|
abort ();
|
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* If this is an undefined label, LABEL_REFS (label) contains
|
|
|
|
|
garbage. */
|
1996-03-05 15:32:16 +01:00
|
|
|
|
if (INSN_UID (label) == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* Don't make a duplicate in the code_label's chain. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1993-09-23 08:07:19 +02:00
|
|
|
|
for (ref = LABEL_REFS (label);
|
|
|
|
|
ref && ref != label;
|
|
|
|
|
ref = LABEL_NEXTREF (ref))
|
1991-12-26 11:05:42 +01:00
|
|
|
|
if (CONTAINING_INSN (ref) == insn)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
CONTAINING_INSN (pat) = insn;
|
|
|
|
|
LABEL_NEXTREF (pat) = LABEL_REFS (label);
|
|
|
|
|
LABEL_REFS (label) = pat;
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fmt = GET_RTX_FORMAT (code);
|
|
|
|
|
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
if (fmt[i] == 'e')
|
|
|
|
|
record_label_references (insn, XEXP (pat, i));
|
|
|
|
|
if (fmt[i] == 'E')
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
int j;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
for (j = 0; j < XVECLEN (pat, i); j++)
|
|
|
|
|
record_label_references (insn, XVECEXP (pat, i, j));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return a pointer to the REG expression within PAT. If PAT is not a
|
|
|
|
|
REG, possible enclosed by a conversion rtx, return the inner part of
|
1996-07-04 00:07:53 +02:00
|
|
|
|
PAT that stopped the search. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
static rtx *
|
|
|
|
|
get_true_reg (pat)
|
|
|
|
|
rtx *pat;
|
|
|
|
|
{
|
1995-04-26 01:06:57 +02:00
|
|
|
|
for (;;)
|
1999-09-02 06:20:21 +02:00
|
|
|
|
switch (GET_CODE (*pat))
|
1995-04-26 01:06:57 +02:00
|
|
|
|
{
|
1999-09-02 06:20:21 +02:00
|
|
|
|
case SUBREG:
|
|
|
|
|
/* Eliminate FP subregister accesses in favour of the
|
|
|
|
|
actual FP register in use. */
|
|
|
|
|
{
|
|
|
|
|
rtx subreg;
|
|
|
|
|
if (FP_REG_P (subreg = SUBREG_REG (*pat)))
|
1995-04-26 01:06:57 +02:00
|
|
|
|
{
|
Use byte offsets in SUBREGs instead of words.
2001-04-03 Jakub Jelinek <jakub@redhat.com>
David S. Miller <davem@pierdol.cobaltmicro.com>
Andrew MacLeod <amacleod@redhat.com>
Use byte offsets in SUBREGs instead of words.
* alias.c (nonlocal_mentioned_p): Use subreg_regno function.
* caller-save.c (mark_set_regs): Change callers of subreg_hard_regno
to pass new argument.
(add_stored_regs): Use subreg_regno_offset function.
* calls.c (expand_call): For non-paradoxical SUBREG take endianess
into account.
(precompute_arguments): Use gen_lowpart_SUBREG.
* combine.c (try_combine): Replace explicit XEXP with SUBREG_REG.
(combine_simplify_rtx): Rework to use SUBREG_BYTE.
(simplify_set): Rework to use SUBREG_BYTE.
(expand_field_assignment): Use SUBREG_BYTE.
(make_extraction): Use SUBREG_BYTE.
(if_then_else_cond): Use SUBREG_BYTE.
(apply_distributive_law): Use SUBREG_BYTE and fixup subreg comments.
(gen_lowpart_for_combine): Compute full byte offset.
* cse.c (mention_regs): Use SUBREG_BYTE.
(remove_invalid_subreg_refs): Rework to use SUBREG_BYTE.
(canon_hash): Use SUBREG_BYTE.
(fold_rtx): Pass SUBREG_BYTE div UNITS_PER_WORD to operand_subword.
(gen_lowpart_if_possible): Formatting.
* dbxout.c (dbxout_symbol_location): Compute SUBREG hard regnos
correctly.
* dwarf2out.c (is_pseudo_reg): Fixup explicit XEXP into SUBREG_REG
(mem_loc_descriptor): Fixup explicit XEXP into SUBREG_REG
(loc_descriptor): Fixup explicit XEXP into SUBREG_REG
* dwarfout.c (is_pseudo_reg): Fixup explicit XEXP into SUBREG_REG
(output_mem_loc_descriptor): Fixup explicit XEXP into SUBREG_REG
(output_loc_descriptor): Fixup explicit XEXP into SUBREG_REG
* emit-rtl.c (gen_rtx_SUBREG): New function, used to verify
certain invariants about SUBREGs the compiler creates.
(gen_lowpart_SUBREG): New function.
(subreg_hard_regno): New function to get the final register number.
(gen_lowpart_common): Use SUBREG_BYTE.
(gen_imagpart): Spacing nits.
(subreg_realpart_p): Use SUBREG_BYTE.
(gen_highpart): Use SUBREG_BYTE.
(subreg_lowpart_p): Always compute endian corrected goal offset,
even at the byte level, then compare against that.
(constant_subword): New function, pulled out all constant cases
from operand_subword and changed second argument name to offset.
(operand_subword): Detect non REG/SUBREG/CONCAT/MEM cases early
and call constant_subword to do the work. Return const0_rtx if
looking for a word outside of OP.
(operand_subword_force): Change second arg name to offset.
* expmed.c (store_bit_field): Use SUBREG_BYTE.
(store_split_bit_field): Use SUBREG_BYTE.
(extract_bit_field): Use SUBREG_BYTE.
(extract_split_bit_field): Use SUBREG_BYTE.
(expand_shift): Use SUBREG_BYTE.
* expr.c (store_expr, expand_expr): Use gen_lowpart_SUBREG.
* final.c (alter_subreg) Use subreg_hard_regno and SUBREG_BYTE.
* flow.c (set_noop_p): Use SUBREG_BYTE.
(mark_set_1): Remove ALTER_HARD_SUBREG. Use subreg_regno_offset instead.
* function.c (fixup_var_refs_1): Fixup explicit XEXP into a SUBREG_REG.
(fixup_memory_subreg): Use SUBREG_BYTE and remove byte endian
correction code.
(optimize_bit_field): Use SUBREG_BYTE.
(purge_addressof_1): Use SUBREG_BYTE.
(purge_single_hard_subreg_set): Use subreg_regno_offset function.
(assign_params): Mark arguments SUBREG_PROMOTED_VAR_P if they are
actually promoted by the caller and PROMOTE_FOR_CALLS_ONLY is true.
* gengenrtl.c (special_rtx): Add SUBREG.
* global.c (mark_reg_store): Use SUBREG_BYTE.
(set_preference): Rework to use subreg_regno_offset and SUBREG_BYTE.
* ifcvt (noce_emit_move_insn): Use SUBREG_BYTE.
* integrate.c (copy_rtx_and_substitute): Use SUBREG_BYTE and make sure
final byte offset is congruent to subreg's mode size.
(subst_constants): Use SUBREG_BYTE.
(mark_stores): Use subreg_regno_offset function.
* jump.c (rtx_renumbered_equal_p, true_regnum): Use subreg_regno_offset
function and SUBREG_BYTE.
* local-alloc.c (combine_regs): Use subreg_regno_offset function.
(reg_is_born): Use subreg_hard_regno.
* recog.c (valid_replace_rtx_1): Use SUBREG_BYTE and remove byte
endian correction code. Don't combine subregs unless resulting
offset aligns with type. Fix subreg constant extraction for DImode.
Simplify SUBREG of VOIDmode CONST_DOUBLE.
(general_operand): Remove dead mode_altering_drug code.
(indirect_operand): Use SUBREG_BYTE.
(constrain_operands): Use subreg_regno_offset function.
* reg-stack.c (get_true_reg): Use subreg_regno_offset function.
* regmove.c (regmove_optimize): Use SUBREG_BYTE.
(optimize_reg_copy_3): Use gen_lowpart_SUBREG.
* regs.h (REG_SIZE): Allow target to override.
(REGMODE_NATURAL_SIZE): New macro which target can override.
* reload.c (reload_inner_reg_of_subreg): subreg_regno should be used
on the entire subreg rtx.
(push_reload): Use SUBREG_BYTE in comments and code.
(find_dummy_reload): Use subreg_regno_offset. Only adjust offsets
for hard registers inside subregs.
(operands_match_p): Use subreg_regno_offset.
(find_reloads): Use SUBREG_BYTE and only advance offset for subregs
containing hard regs.
(find_reload_toplev): Use SUBREG_BYTE. Remove byte endian
corrections when fixing up MEM subregs.
(find_reloads_address_1): Use SUBREG_BYTE, subreg_regno, and
subreg_regno_offset where appropriate.
(find_reloads_subreg_address): Use SUBREG_BYTE. Remove
byte endian corrections when fixing up MEM subregs.
(subst_reloads): When combining two subregs, make sure final
offset is congruent to subreg's mode size.
(find_replacement): Use SUBREG_BYTE and subreg_regno_offset.
(refers_to_regno_for_reload_p): Use subreg_regno.
(reg_overlap_mentioned_for_reload_p): Use subreg_regno_offset.
* reload1.c (eliminate_regs) Use SUBREG_BYTE. Remove byte endian
correction code for memory subreg fixups.
(forget_old_reload_1): Use subreg_regno_offset.
(choose_reload_regs): Use subreg_regno.
(emit_input_reload_insns): Use SUBREG_BYTE.
(reload_combine_note_store): Use subreg_regno_offset.
(move2add_note_store): Use subreg_regno_offset.
* resource.c (update_live_status, mark_referenced_resources): Use
subreg_regno function.
(mark_set_resources): Use subreg_regno function.
* rtl.h (SUBREG_WORD): Rename to SUBREG_BYTE.
(subreg_regno_offset, subreg_regno): Define prototypes.
(subreg_hard_regno, constant_subword, gen_rtx_SUBREG): Newi functions.
(gen_lowpart_SUBREG): Add prototype.
* rtl.texi (subreg): Update to reflect new byte offset representation.
Add mentioning of the effect that BYTES_BIG_ENDIAN has on subregs now.
* rtlanal.c (refers_to_regno_p): Use subreg_regno.
(reg_overlap_mentioned_p): Use subreg_regno.
(replace_regs); Make sure final offset of combined subreg is
congruent to size of subreg's mode.
(subreg_regno_offset): New function.
(subreg_regno): New function.
* sched-vis.c (print_value): Change SUBREG_WORD to SUBREG_BYTE.
* sdbout.c (sdbout_symbol): Compute offset using alter_subreg.
* stmt.c (expand_anon_union_decl): Use gen_lowpart_SUBREG.
* tm.texi (ALTER_HARD_SUBREG): Remove, it is now dead.
(SUBREG_REGNO_OFFSET): Describe SUBREG_REGNO_OFFSET overrides.
* config/a29k/a29k.c (gpc_reg_operand): Use subreg_regno.
(a29k_get_reloaded_address): Use SUBREG_BYTE.
(print_operand): Use SUBREG_BYTE.
* config/alpha/alpha.c (print_operand_address): Use SUBREG_BYTE.
* config/arm/arm.c (arm_reload_in_hi): Use SUBREG_BYTE.
(arm_reload_out_hi): Use SUBREG_BYTE.
* config/d30v/d30v.c (d30v_split_double): Use subreg_regno_offset
instead of SUBREG_WORD.
(d30v_print_operand_memory_reference): Use subreg_regno_offset.
* config/dsp16xx/dsp16xx.md (extendqihi2, zero_extendqihi2): Fix
SUBREG creation to use byte offset.
* config/h8300/h8300.md (Unnamed HImode zero extraction and 16bit
inverted load insns): Fix explicit rtl subregs to use byte
offsets.
* config/i370/i370.md (cmpstrsi, movstrsi, mulsi3, divsi3,
udivsi3, umodsi3): Generate SUBREGs with byte offsets.
* config/i860/i860.c (single_insn_src_p): Use SUBREG_BYTE.
* config/i860/i860.md (mulsi3_big): Fixup explicit SUBREGs in rtl
to use byte offsets.
(unnamed fmlow.dd insn): Fixup SUBREGS to use byte offsets.
* config/i960/i960.md (extendhisi2): Generate SUBREGs with byte
offsets, also make sure it is congruent to SUBREG's mode size.
(extendqisi2, extendqihi2, zero_extendhisi2, zero_extendqisi2,
unnamed ldob insn): Generate SUBREGs with byte offset.
(zero_extendqihi2): SUBREG's are byte offsets.
* config/m68hc11/m68hc11.c (m68hc11_gen_lowpart): Use SUBREG_BYTE.
(m68hc11_gen_highpart): Use SUBREG_BYTE.
* config/m68k/m68k.md (zero_extendhisi2, zero_extendqihi2,
zero-extendqisi2): Generate SUBREGs with byte offset.
(umulsidi3, mulsidi3, subreghi1ashrdi_const32,
subregsi1ashrdi_const32, subreg1lshrdi_const32): Fixup explicit
subregs in rtl to use byte offsets.
* config/m88k/m88k.md (extendsidi2): fixup subregs to use byte offset.
* config/mips/mips.c (mips_move_1word): Use subreg_regno_offset.
(mips_move_2words): Use subreg_regno_offset.
(mips_secondary_reload_class): Use subreg_regno_offset.
* config/mips/mips.md (DImode plus, minus, move, and logical op
splits): Fixup explicit subregs in rtl to use byte offsets.
* config/mn10200/mn10200.c (print_operand): Use subreg_regno function.
* config/mn10300/mn10300.c (print_operand): Use subreg_regno function.
* config/ns32k/ns32k.md (udivmoddisi4): Fix explicit subregs in
rtl to use byte offsets.
* config/pa/pa.c (emit_move_sequence): Use SUBREG_BYTE.
* config/pa/pa.md (floatunssisf2, floatunssidf2, mulsi3): fix explicit
subregs to use byte offsets.
* config/pdp11/pdp11.md (zero_extendhisi2, modhi3, modhi3+1):
Fixup explicit subregs in rtl to use byte offsets.
* config/romp/romp.c (memory_offset_in_range_p): Use SUBREG_BYTE
and remove byte endian correction code.
* config/sh/sh.c (output_movedouble): Use subreg_regno.
(gen_ashift_hi): Use SUBREG_BYTE.
(regs_used): Use subreg_regno_offset.
(machine_dependent_reorg): Use subreg_regno_offset.
* config/sh/sh.h (INDEX_REGISTER_RTX_P): Use SUBREG_BYTE.
* config/sh/sh.md (DImode and DFmode move splits): Use subreg_regno.
(movdf_i4): Subregs are byte offsets now.
* config/sparc/sparc.c (ultra_find_type): Use SUBREG_BYTE.
* config/sparc/sparc.h (ALTER_HARD_SUBREG): Removed.
(REGMODE_NATURAL_SIZE): Override.
(REG_SIZE): For SUBREG check float mode on SUBREG_REG's mode.
* config/sparc/sparc.md (TFmode move splits): Generate SUBREGs
with byte offsets.
(zero_extendhisi2, zero_extendqidi2_insn, extendhisi2,
extendqihi2, sign_extendqihi2_insn, sign_extendqisi2_insn,
extendqidi2): Generate SUBREGs with byte offsets, also make sure
it is congruent to SUBREG's mode size.
(smulsi3_highpart_v8plus): Fix explicit subregs in rtl to use byte
offsets.
(cmp_siqi_trunc, cmp_siqi_trunc_set, cmp_diqi_trunc,
cmp_diqi_trunc_set, lshrdi3_v8plus+1, lshrdi3_v8plus+2,
lshrdi3_v8plus+3, lshrdi3_v8plus+4): Use proper
SUBREG_BYTE offset for non-paradoxical subregs in patterns.
* config/v850/v850.c (print_operand, output_move_double): Use
subreg_regno function.
Co-Authored-By: Andrew MacLeod <amacleod@redhat.com>
Co-Authored-By: David S. Miller <davem@pierdol.cobaltmicro.com>
From-SVN: r41058
2001-04-03 17:06:12 +02:00
|
|
|
|
int regno_off = subreg_regno_offset (REGNO (subreg),
|
|
|
|
|
GET_MODE (subreg),
|
|
|
|
|
SUBREG_BYTE (*pat),
|
|
|
|
|
GET_MODE (*pat));
|
|
|
|
|
*pat = FP_MODE_REG (REGNO (subreg) + regno_off,
|
1995-04-26 01:06:57 +02:00
|
|
|
|
GET_MODE (subreg));
|
1999-09-02 06:20:21 +02:00
|
|
|
|
default:
|
1995-04-26 01:06:57 +02:00
|
|
|
|
return pat;
|
|
|
|
|
}
|
1999-09-02 06:20:21 +02:00
|
|
|
|
}
|
|
|
|
|
case FLOAT:
|
|
|
|
|
case FIX:
|
|
|
|
|
case FLOAT_EXTEND:
|
|
|
|
|
pat = & XEXP (*pat, 0);
|
1995-04-26 01:06:57 +02:00
|
|
|
|
}
|
1991-12-26 11:05:42 +01:00
|
|
|
|
}
|
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* There are many rules that an asm statement for stack-like regs must
|
1992-01-19 05:23:39 +01:00
|
|
|
|
follow. Those rules are explained at the top of this file: the rule
|
1996-07-04 00:07:53 +02:00
|
|
|
|
numbers below refer to that explanation. */
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
static int
|
|
|
|
|
check_asm_stack_operands (insn)
|
1992-01-19 05:23:39 +01:00
|
|
|
|
rtx insn;
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
int n_clobbers;
|
|
|
|
|
int malformed_asm = 0;
|
|
|
|
|
rtx body = PATTERN (insn);
|
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
char reg_used_as_output[FIRST_PSEUDO_REGISTER];
|
|
|
|
|
char implicitly_dies[FIRST_PSEUDO_REGISTER];
|
1998-12-04 13:55:59 +01:00
|
|
|
|
int alt;
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
2000-01-04 17:29:41 +01:00
|
|
|
|
rtx *clobber_reg = 0;
|
1998-12-04 13:55:59 +01:00
|
|
|
|
int n_inputs, n_outputs;
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
1992-08-28 03:24:42 +02:00
|
|
|
|
/* Find out what the constraints require. If no constraint
|
1993-05-05 23:41:42 +02:00
|
|
|
|
alternative matches, this asm is malformed. */
|
1998-12-04 13:55:59 +01:00
|
|
|
|
extract_insn (insn);
|
|
|
|
|
constrain_operands (1);
|
|
|
|
|
alt = which_alternative;
|
|
|
|
|
|
|
|
|
|
preprocess_constraints ();
|
|
|
|
|
|
|
|
|
|
n_inputs = get_asm_operand_n_inputs (body);
|
1999-09-12 03:51:28 +02:00
|
|
|
|
n_outputs = recog_data.n_operands - n_inputs;
|
1998-12-04 13:55:59 +01:00
|
|
|
|
|
|
|
|
|
if (alt < 0)
|
|
|
|
|
{
|
|
|
|
|
malformed_asm = 1;
|
|
|
|
|
/* Avoid further trouble with this insn. */
|
|
|
|
|
PATTERN (insn) = gen_rtx_USE (VOIDmode, const0_rtx);
|
1999-10-27 03:25:13 +02:00
|
|
|
|
return 0;
|
1998-12-04 13:55:59 +01:00
|
|
|
|
}
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* Strip SUBREGs here to make the following code simpler. */
|
1999-09-12 03:51:28 +02:00
|
|
|
|
for (i = 0; i < recog_data.n_operands; i++)
|
|
|
|
|
if (GET_CODE (recog_data.operand[i]) == SUBREG
|
|
|
|
|
&& GET_CODE (SUBREG_REG (recog_data.operand[i])) == REG)
|
|
|
|
|
recog_data.operand[i] = SUBREG_REG (recog_data.operand[i]);
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
|
|
|
|
/* Set up CLOBBER_REG. */
|
|
|
|
|
|
|
|
|
|
n_clobbers = 0;
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (body) == PARALLEL)
|
1992-03-21 05:53:32 +01:00
|
|
|
|
{
|
1998-10-09 18:08:51 +02:00
|
|
|
|
clobber_reg = (rtx *) alloca (XVECLEN (body, 0) * sizeof (rtx));
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
1992-03-21 05:53:32 +01:00
|
|
|
|
for (i = 0; i < XVECLEN (body, 0); i++)
|
|
|
|
|
if (GET_CODE (XVECEXP (body, 0, i)) == CLOBBER)
|
|
|
|
|
{
|
|
|
|
|
rtx clobber = XVECEXP (body, 0, i);
|
|
|
|
|
rtx reg = XEXP (clobber, 0);
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
1992-03-21 05:53:32 +01:00
|
|
|
|
if (GET_CODE (reg) == SUBREG && GET_CODE (SUBREG_REG (reg)) == REG)
|
|
|
|
|
reg = SUBREG_REG (reg);
|
|
|
|
|
|
|
|
|
|
if (STACK_REG_P (reg))
|
|
|
|
|
{
|
|
|
|
|
clobber_reg[n_clobbers] = reg;
|
|
|
|
|
n_clobbers++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
|
|
|
|
/* Enforce rule #4: Output operands must specifically indicate which
|
|
|
|
|
reg an output appears in after an asm. "=f" is not allowed: the
|
|
|
|
|
operand constraints must select a class with a single reg.
|
|
|
|
|
|
|
|
|
|
Also enforce rule #5: Output operands must start at the top of
|
1996-07-04 00:07:53 +02:00
|
|
|
|
the reg-stack: output operands may not "skip" a reg. */
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
memset (reg_used_as_output, 0, sizeof (reg_used_as_output));
|
1992-01-19 05:23:39 +01:00
|
|
|
|
for (i = 0; i < n_outputs; i++)
|
1999-09-12 03:51:28 +02:00
|
|
|
|
if (STACK_REG_P (recog_data.operand[i]))
|
1998-03-12 01:43:09 +01:00
|
|
|
|
{
|
1998-12-04 13:55:59 +01:00
|
|
|
|
if (reg_class_size[(int) recog_op_alt[i][alt].class] != 1)
|
1998-03-12 01:43:09 +01:00
|
|
|
|
{
|
c-decl.c (duplicate_decls, [...]): Remove leading capital from diagnostics.
* c-decl.c (duplicate_decls, push_parm_decl): Remove leading
capital from diagnostics.
* c-lex.c (cb_file_change): Similarly.
* c-parse.in : Similarly.
* cfgrtl.c (verify_flow_info): Similarly.
* collect2.c: Similarly.
* cppfiles.c (find_include_file): Similarly.
* cppinit.c (cpp_handle_option): Similarly.
* cpplex.c (cpp_spell_token): Similarly.
* cppmain.c (do_preprocessing): Similarly.
* gcc.c (translate_options, process_command, do_spec1,
main, pfatal_execute): Similarly.
* genattr.c (main): Similarly.
* genattrtab.c (check_attr_test, operate_exp, simplify_test_exp,
write_test_expr, main): Similarly.
* gencodes.c (main): Similarly.
* genconfig.c (main): Similarly.
* genconstants.c (main): Similarly.
* genemit.c (main): Similarly.
* genextract.c (main): Similarly.
* genflags.c (main): Similarly.
* genopinit.c (main): Similarly.
* genoutput.c (process_template, main): Similarly.
* genpeep.c (main): Similarly.
* genrecog.c (main): Similarly.
* gensupport.c (is_predicable, identify_predicable_attribute,
alter_predicate_for_insn, init_md_reader_args, main): Similarly.
* ggc-page.c (alloc_anon): Similarly.
* mips-tfile.c (add_string, add_procedure, add_file, read_line,
parse_begin, parse_bend, parse_def, parse_end, parse_file,
parse_stabs_common, parse_stabs, write_varray, write_object,
read_seek, copy_object, main, error): Similarly.
* profile.c (compute_branch_probabilities): Similarly.
* reg-stack.c (check_asm_stack_operands): Similarly.
* reload.c (find_reloads): Similarly.
* reload1.c (spill_failure, failed_reload): Similarly.
* rtl-error.c (_fatal_insn_not_found): Similarly.
* toplev.c (read_integral_parameter, crash_signal,
decode_f_option, set_target_switch, parse_options_and_default_flags)
: Similarly.
* tradcif.y (parse_number, yylex): Similarly.
* tradcpp.c (main, fancy_abort): Similarly.
* tree.c (tree_check_failed): Similarly.
* varray.c (varray_check_failed): Similarly.
* xcoffout.c (xcoff_output_standard_types): Similarly.
cp:
* call.c (build_java_interface_fn_ref): Similarly.
* except.c (is_admissible_throw_operand): Similarly.
* init.c (build_java_class_ref): Similarly.
* xref.c (open_xref_file): Similarly.
objc:
* objc-act.c (get_object_ref, lookup_and_install_protocols,
build_objc_string_object, objc_declare_alias, build_ivar_chain,
finish_message_expr, build_protocol_expr, is_public,
start_class): Similarly.
testsuite:
* objc.dg/alias.m: Update.
* objc.dg/class-1.m: Update.
* objc.dg/const-str-1.m: Update.
* objc.dg/fwd-proto-1.m: Update.
* objc.dg/id-1.m: Update.
* objc.dg/super-class-1.m: Update.
From-SVN: r47518
2001-12-02 01:04:36 +01:00
|
|
|
|
error_for_asm (insn, "output constraint %d must specify a single register", i);
|
1998-03-12 01:43:09 +01:00
|
|
|
|
malformed_asm = 1;
|
|
|
|
|
}
|
2002-05-09 03:42:28 +02:00
|
|
|
|
else
|
2001-04-20 10:06:03 +02:00
|
|
|
|
{
|
|
|
|
|
int j;
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < n_clobbers; j++)
|
|
|
|
|
if (REGNO (recog_data.operand[i]) == REGNO (clobber_reg[j]))
|
|
|
|
|
{
|
c-decl.c (duplicate_decls, [...]): Remove leading capital from diagnostics.
* c-decl.c (duplicate_decls, push_parm_decl): Remove leading
capital from diagnostics.
* c-lex.c (cb_file_change): Similarly.
* c-parse.in : Similarly.
* cfgrtl.c (verify_flow_info): Similarly.
* collect2.c: Similarly.
* cppfiles.c (find_include_file): Similarly.
* cppinit.c (cpp_handle_option): Similarly.
* cpplex.c (cpp_spell_token): Similarly.
* cppmain.c (do_preprocessing): Similarly.
* gcc.c (translate_options, process_command, do_spec1,
main, pfatal_execute): Similarly.
* genattr.c (main): Similarly.
* genattrtab.c (check_attr_test, operate_exp, simplify_test_exp,
write_test_expr, main): Similarly.
* gencodes.c (main): Similarly.
* genconfig.c (main): Similarly.
* genconstants.c (main): Similarly.
* genemit.c (main): Similarly.
* genextract.c (main): Similarly.
* genflags.c (main): Similarly.
* genopinit.c (main): Similarly.
* genoutput.c (process_template, main): Similarly.
* genpeep.c (main): Similarly.
* genrecog.c (main): Similarly.
* gensupport.c (is_predicable, identify_predicable_attribute,
alter_predicate_for_insn, init_md_reader_args, main): Similarly.
* ggc-page.c (alloc_anon): Similarly.
* mips-tfile.c (add_string, add_procedure, add_file, read_line,
parse_begin, parse_bend, parse_def, parse_end, parse_file,
parse_stabs_common, parse_stabs, write_varray, write_object,
read_seek, copy_object, main, error): Similarly.
* profile.c (compute_branch_probabilities): Similarly.
* reg-stack.c (check_asm_stack_operands): Similarly.
* reload.c (find_reloads): Similarly.
* reload1.c (spill_failure, failed_reload): Similarly.
* rtl-error.c (_fatal_insn_not_found): Similarly.
* toplev.c (read_integral_parameter, crash_signal,
decode_f_option, set_target_switch, parse_options_and_default_flags)
: Similarly.
* tradcif.y (parse_number, yylex): Similarly.
* tradcpp.c (main, fancy_abort): Similarly.
* tree.c (tree_check_failed): Similarly.
* varray.c (varray_check_failed): Similarly.
* xcoffout.c (xcoff_output_standard_types): Similarly.
cp:
* call.c (build_java_interface_fn_ref): Similarly.
* except.c (is_admissible_throw_operand): Similarly.
* init.c (build_java_class_ref): Similarly.
* xref.c (open_xref_file): Similarly.
objc:
* objc-act.c (get_object_ref, lookup_and_install_protocols,
build_objc_string_object, objc_declare_alias, build_ivar_chain,
finish_message_expr, build_protocol_expr, is_public,
start_class): Similarly.
testsuite:
* objc.dg/alias.m: Update.
* objc.dg/class-1.m: Update.
* objc.dg/const-str-1.m: Update.
* objc.dg/fwd-proto-1.m: Update.
* objc.dg/id-1.m: Update.
* objc.dg/super-class-1.m: Update.
From-SVN: r47518
2001-12-02 01:04:36 +01:00
|
|
|
|
error_for_asm (insn, "output constraint %d cannot be specified together with \"%s\" clobber",
|
2001-04-20 10:06:03 +02:00
|
|
|
|
i, reg_names [REGNO (clobber_reg[j])]);
|
|
|
|
|
malformed_asm = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (j == n_clobbers)
|
|
|
|
|
reg_used_as_output[REGNO (recog_data.operand[i])] = 1;
|
|
|
|
|
}
|
1998-03-12 01:43:09 +01:00
|
|
|
|
}
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Search for first non-popped reg. */
|
|
|
|
|
for (i = FIRST_STACK_REG; i < LAST_STACK_REG + 1; i++)
|
|
|
|
|
if (! reg_used_as_output[i])
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* If there are any other popped regs, that's an error. */
|
|
|
|
|
for (; i < LAST_STACK_REG + 1; i++)
|
|
|
|
|
if (reg_used_as_output[i])
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if (i != LAST_STACK_REG + 1)
|
|
|
|
|
{
|
c-decl.c (duplicate_decls, [...]): Remove leading capital from diagnostics.
* c-decl.c (duplicate_decls, push_parm_decl): Remove leading
capital from diagnostics.
* c-lex.c (cb_file_change): Similarly.
* c-parse.in : Similarly.
* cfgrtl.c (verify_flow_info): Similarly.
* collect2.c: Similarly.
* cppfiles.c (find_include_file): Similarly.
* cppinit.c (cpp_handle_option): Similarly.
* cpplex.c (cpp_spell_token): Similarly.
* cppmain.c (do_preprocessing): Similarly.
* gcc.c (translate_options, process_command, do_spec1,
main, pfatal_execute): Similarly.
* genattr.c (main): Similarly.
* genattrtab.c (check_attr_test, operate_exp, simplify_test_exp,
write_test_expr, main): Similarly.
* gencodes.c (main): Similarly.
* genconfig.c (main): Similarly.
* genconstants.c (main): Similarly.
* genemit.c (main): Similarly.
* genextract.c (main): Similarly.
* genflags.c (main): Similarly.
* genopinit.c (main): Similarly.
* genoutput.c (process_template, main): Similarly.
* genpeep.c (main): Similarly.
* genrecog.c (main): Similarly.
* gensupport.c (is_predicable, identify_predicable_attribute,
alter_predicate_for_insn, init_md_reader_args, main): Similarly.
* ggc-page.c (alloc_anon): Similarly.
* mips-tfile.c (add_string, add_procedure, add_file, read_line,
parse_begin, parse_bend, parse_def, parse_end, parse_file,
parse_stabs_common, parse_stabs, write_varray, write_object,
read_seek, copy_object, main, error): Similarly.
* profile.c (compute_branch_probabilities): Similarly.
* reg-stack.c (check_asm_stack_operands): Similarly.
* reload.c (find_reloads): Similarly.
* reload1.c (spill_failure, failed_reload): Similarly.
* rtl-error.c (_fatal_insn_not_found): Similarly.
* toplev.c (read_integral_parameter, crash_signal,
decode_f_option, set_target_switch, parse_options_and_default_flags)
: Similarly.
* tradcif.y (parse_number, yylex): Similarly.
* tradcpp.c (main, fancy_abort): Similarly.
* tree.c (tree_check_failed): Similarly.
* varray.c (varray_check_failed): Similarly.
* xcoffout.c (xcoff_output_standard_types): Similarly.
cp:
* call.c (build_java_interface_fn_ref): Similarly.
* except.c (is_admissible_throw_operand): Similarly.
* init.c (build_java_class_ref): Similarly.
* xref.c (open_xref_file): Similarly.
objc:
* objc-act.c (get_object_ref, lookup_and_install_protocols,
build_objc_string_object, objc_declare_alias, build_ivar_chain,
finish_message_expr, build_protocol_expr, is_public,
start_class): Similarly.
testsuite:
* objc.dg/alias.m: Update.
* objc.dg/class-1.m: Update.
* objc.dg/const-str-1.m: Update.
* objc.dg/fwd-proto-1.m: Update.
* objc.dg/id-1.m: Update.
* objc.dg/super-class-1.m: Update.
From-SVN: r47518
2001-12-02 01:04:36 +01:00
|
|
|
|
error_for_asm (insn, "output regs must be grouped at top of stack");
|
1992-01-19 05:23:39 +01:00
|
|
|
|
malformed_asm = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Enforce rule #2: All implicitly popped input regs must be closer
|
|
|
|
|
to the top of the reg-stack than any input that is not implicitly
|
1996-07-04 00:07:53 +02:00
|
|
|
|
popped. */
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
memset (implicitly_dies, 0, sizeof (implicitly_dies));
|
1998-12-04 13:55:59 +01:00
|
|
|
|
for (i = n_outputs; i < n_outputs + n_inputs; i++)
|
1999-09-12 03:51:28 +02:00
|
|
|
|
if (STACK_REG_P (recog_data.operand[i]))
|
1992-01-19 05:23:39 +01:00
|
|
|
|
{
|
|
|
|
|
/* An input reg is implicitly popped if it is tied to an
|
1996-07-04 00:07:53 +02:00
|
|
|
|
output, or if there is a CLOBBER for it. */
|
1992-01-19 05:23:39 +01:00
|
|
|
|
int j;
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < n_clobbers; j++)
|
1999-09-12 03:51:28 +02:00
|
|
|
|
if (operands_match_p (clobber_reg[j], recog_data.operand[i]))
|
1992-01-19 05:23:39 +01:00
|
|
|
|
break;
|
|
|
|
|
|
1998-12-04 13:55:59 +01:00
|
|
|
|
if (j < n_clobbers || recog_op_alt[i][alt].matches >= 0)
|
1999-09-12 03:51:28 +02:00
|
|
|
|
implicitly_dies[REGNO (recog_data.operand[i])] = 1;
|
1992-01-19 05:23:39 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Search for first non-popped reg. */
|
|
|
|
|
for (i = FIRST_STACK_REG; i < LAST_STACK_REG + 1; i++)
|
|
|
|
|
if (! implicitly_dies[i])
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* If there are any other popped regs, that's an error. */
|
|
|
|
|
for (; i < LAST_STACK_REG + 1; i++)
|
|
|
|
|
if (implicitly_dies[i])
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if (i != LAST_STACK_REG + 1)
|
|
|
|
|
{
|
|
|
|
|
error_for_asm (insn,
|
c-decl.c (duplicate_decls, [...]): Remove leading capital from diagnostics.
* c-decl.c (duplicate_decls, push_parm_decl): Remove leading
capital from diagnostics.
* c-lex.c (cb_file_change): Similarly.
* c-parse.in : Similarly.
* cfgrtl.c (verify_flow_info): Similarly.
* collect2.c: Similarly.
* cppfiles.c (find_include_file): Similarly.
* cppinit.c (cpp_handle_option): Similarly.
* cpplex.c (cpp_spell_token): Similarly.
* cppmain.c (do_preprocessing): Similarly.
* gcc.c (translate_options, process_command, do_spec1,
main, pfatal_execute): Similarly.
* genattr.c (main): Similarly.
* genattrtab.c (check_attr_test, operate_exp, simplify_test_exp,
write_test_expr, main): Similarly.
* gencodes.c (main): Similarly.
* genconfig.c (main): Similarly.
* genconstants.c (main): Similarly.
* genemit.c (main): Similarly.
* genextract.c (main): Similarly.
* genflags.c (main): Similarly.
* genopinit.c (main): Similarly.
* genoutput.c (process_template, main): Similarly.
* genpeep.c (main): Similarly.
* genrecog.c (main): Similarly.
* gensupport.c (is_predicable, identify_predicable_attribute,
alter_predicate_for_insn, init_md_reader_args, main): Similarly.
* ggc-page.c (alloc_anon): Similarly.
* mips-tfile.c (add_string, add_procedure, add_file, read_line,
parse_begin, parse_bend, parse_def, parse_end, parse_file,
parse_stabs_common, parse_stabs, write_varray, write_object,
read_seek, copy_object, main, error): Similarly.
* profile.c (compute_branch_probabilities): Similarly.
* reg-stack.c (check_asm_stack_operands): Similarly.
* reload.c (find_reloads): Similarly.
* reload1.c (spill_failure, failed_reload): Similarly.
* rtl-error.c (_fatal_insn_not_found): Similarly.
* toplev.c (read_integral_parameter, crash_signal,
decode_f_option, set_target_switch, parse_options_and_default_flags)
: Similarly.
* tradcif.y (parse_number, yylex): Similarly.
* tradcpp.c (main, fancy_abort): Similarly.
* tree.c (tree_check_failed): Similarly.
* varray.c (varray_check_failed): Similarly.
* xcoffout.c (xcoff_output_standard_types): Similarly.
cp:
* call.c (build_java_interface_fn_ref): Similarly.
* except.c (is_admissible_throw_operand): Similarly.
* init.c (build_java_class_ref): Similarly.
* xref.c (open_xref_file): Similarly.
objc:
* objc-act.c (get_object_ref, lookup_and_install_protocols,
build_objc_string_object, objc_declare_alias, build_ivar_chain,
finish_message_expr, build_protocol_expr, is_public,
start_class): Similarly.
testsuite:
* objc.dg/alias.m: Update.
* objc.dg/class-1.m: Update.
* objc.dg/const-str-1.m: Update.
* objc.dg/fwd-proto-1.m: Update.
* objc.dg/id-1.m: Update.
* objc.dg/super-class-1.m: Update.
From-SVN: r47518
2001-12-02 01:04:36 +01:00
|
|
|
|
"implicitly popped regs must be grouped at top of stack");
|
1992-01-19 05:23:39 +01:00
|
|
|
|
malformed_asm = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Enfore rule #3: If any input operand uses the "f" constraint, all
|
|
|
|
|
output constraints must use the "&" earlyclobber.
|
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
??? Detect this more deterministically by having constrain_asm_operands
|
1996-07-04 00:07:53 +02:00
|
|
|
|
record any earlyclobber. */
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
1998-12-04 13:55:59 +01:00
|
|
|
|
for (i = n_outputs; i < n_outputs + n_inputs; i++)
|
|
|
|
|
if (recog_op_alt[i][alt].matches == -1)
|
1992-01-19 05:23:39 +01:00
|
|
|
|
{
|
|
|
|
|
int j;
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < n_outputs; j++)
|
1999-09-12 03:51:28 +02:00
|
|
|
|
if (operands_match_p (recog_data.operand[j], recog_data.operand[i]))
|
1992-01-19 05:23:39 +01:00
|
|
|
|
{
|
|
|
|
|
error_for_asm (insn,
|
c-decl.c (duplicate_decls, [...]): Remove leading capital from diagnostics.
* c-decl.c (duplicate_decls, push_parm_decl): Remove leading
capital from diagnostics.
* c-lex.c (cb_file_change): Similarly.
* c-parse.in : Similarly.
* cfgrtl.c (verify_flow_info): Similarly.
* collect2.c: Similarly.
* cppfiles.c (find_include_file): Similarly.
* cppinit.c (cpp_handle_option): Similarly.
* cpplex.c (cpp_spell_token): Similarly.
* cppmain.c (do_preprocessing): Similarly.
* gcc.c (translate_options, process_command, do_spec1,
main, pfatal_execute): Similarly.
* genattr.c (main): Similarly.
* genattrtab.c (check_attr_test, operate_exp, simplify_test_exp,
write_test_expr, main): Similarly.
* gencodes.c (main): Similarly.
* genconfig.c (main): Similarly.
* genconstants.c (main): Similarly.
* genemit.c (main): Similarly.
* genextract.c (main): Similarly.
* genflags.c (main): Similarly.
* genopinit.c (main): Similarly.
* genoutput.c (process_template, main): Similarly.
* genpeep.c (main): Similarly.
* genrecog.c (main): Similarly.
* gensupport.c (is_predicable, identify_predicable_attribute,
alter_predicate_for_insn, init_md_reader_args, main): Similarly.
* ggc-page.c (alloc_anon): Similarly.
* mips-tfile.c (add_string, add_procedure, add_file, read_line,
parse_begin, parse_bend, parse_def, parse_end, parse_file,
parse_stabs_common, parse_stabs, write_varray, write_object,
read_seek, copy_object, main, error): Similarly.
* profile.c (compute_branch_probabilities): Similarly.
* reg-stack.c (check_asm_stack_operands): Similarly.
* reload.c (find_reloads): Similarly.
* reload1.c (spill_failure, failed_reload): Similarly.
* rtl-error.c (_fatal_insn_not_found): Similarly.
* toplev.c (read_integral_parameter, crash_signal,
decode_f_option, set_target_switch, parse_options_and_default_flags)
: Similarly.
* tradcif.y (parse_number, yylex): Similarly.
* tradcpp.c (main, fancy_abort): Similarly.
* tree.c (tree_check_failed): Similarly.
* varray.c (varray_check_failed): Similarly.
* xcoffout.c (xcoff_output_standard_types): Similarly.
cp:
* call.c (build_java_interface_fn_ref): Similarly.
* except.c (is_admissible_throw_operand): Similarly.
* init.c (build_java_class_ref): Similarly.
* xref.c (open_xref_file): Similarly.
objc:
* objc-act.c (get_object_ref, lookup_and_install_protocols,
build_objc_string_object, objc_declare_alias, build_ivar_chain,
finish_message_expr, build_protocol_expr, is_public,
start_class): Similarly.
testsuite:
* objc.dg/alias.m: Update.
* objc.dg/class-1.m: Update.
* objc.dg/const-str-1.m: Update.
* objc.dg/fwd-proto-1.m: Update.
* objc.dg/id-1.m: Update.
* objc.dg/super-class-1.m: Update.
From-SVN: r47518
2001-12-02 01:04:36 +01:00
|
|
|
|
"output operand %d must use `&' constraint", j);
|
1992-01-19 05:23:39 +01:00
|
|
|
|
malformed_asm = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (malformed_asm)
|
|
|
|
|
{
|
|
|
|
|
/* Avoid further trouble with this insn. */
|
alias.c: Change all uses of gen_rtx(FOO...) to gen_rtx_FOO...
* alias.c: Change all uses of gen_rtx(FOO...) to gen_rtx_FOO;
change gen_rtx(expr...) to gen_rtx_fmt_foo(expr...).
* caller-save.c, calls.c, combine.c, cse.c: Likewise.
* dwarf2out.c, except.c, explow.c, expmed.c, expr.c: Likewise.
* final.c, flow.c, function.c, genpeep.c, haifa-sched.c: Likewise.
* halfpic.c, integrate.c, jump.c, local-alloc.c, loop.c: Likewise.
* profile.c, recog.c, reg-stack.c, regclass.c, regmove.c: Likewise.
* reload.c, reload1.c, reorg.c, sched.c, stmt.c, stupid.c: Likewise.
* unroll.c, varasm.c: Likewise.
* config/alpha/alpha.c, config/alpha/alpha.md: Likewise.
From-SVN: r17357
1998-01-15 00:10:50 +01:00
|
|
|
|
PATTERN (insn) = gen_rtx_USE (VOIDmode, const0_rtx);
|
1999-10-27 03:25:13 +02:00
|
|
|
|
return 0;
|
1992-08-28 03:24:42 +02:00
|
|
|
|
}
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
return 1;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
}
|
|
|
|
|
|
1992-01-19 05:23:39 +01:00
|
|
|
|
/* Calculate the number of inputs and outputs in BODY, an
|
|
|
|
|
asm_operands. N_OPERANDS is the total number of operands, and
|
|
|
|
|
N_INPUTS and N_OUTPUTS are pointers to ints into which the results are
|
1996-07-04 00:07:53 +02:00
|
|
|
|
placed. */
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
1998-12-04 13:55:59 +01:00
|
|
|
|
static int
|
|
|
|
|
get_asm_operand_n_inputs (body)
|
1992-01-19 05:23:39 +01:00
|
|
|
|
rtx body;
|
|
|
|
|
{
|
|
|
|
|
if (GET_CODE (body) == SET && GET_CODE (SET_SRC (body)) == ASM_OPERANDS)
|
1998-12-04 13:55:59 +01:00
|
|
|
|
return ASM_OPERANDS_INPUT_LENGTH (SET_SRC (body));
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
|
|
|
|
else if (GET_CODE (body) == ASM_OPERANDS)
|
1998-12-04 13:55:59 +01:00
|
|
|
|
return ASM_OPERANDS_INPUT_LENGTH (body);
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
|
|
|
|
else if (GET_CODE (body) == PARALLEL
|
|
|
|
|
&& GET_CODE (XVECEXP (body, 0, 0)) == SET)
|
1998-12-04 13:55:59 +01:00
|
|
|
|
return ASM_OPERANDS_INPUT_LENGTH (SET_SRC (XVECEXP (body, 0, 0)));
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
|
|
|
|
else if (GET_CODE (body) == PARALLEL
|
|
|
|
|
&& GET_CODE (XVECEXP (body, 0, 0)) == ASM_OPERANDS)
|
1998-12-04 13:55:59 +01:00
|
|
|
|
return ASM_OPERANDS_INPUT_LENGTH (XVECEXP (body, 0, 0));
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
1998-12-04 13:55:59 +01:00
|
|
|
|
abort ();
|
1992-01-19 05:23:39 +01:00
|
|
|
|
}
|
1994-02-28 12:30:24 +01:00
|
|
|
|
|
1993-06-20 00:32:28 +02:00
|
|
|
|
/* If current function returns its result in an fp stack register,
|
1995-04-28 12:36:36 +02:00
|
|
|
|
return the REG. Otherwise, return 0. */
|
1993-06-20 00:32:28 +02:00
|
|
|
|
|
1995-04-26 01:06:57 +02:00
|
|
|
|
static rtx
|
|
|
|
|
stack_result (decl)
|
1993-06-20 00:32:28 +02:00
|
|
|
|
tree decl;
|
|
|
|
|
{
|
1999-10-19 10:12:30 +02:00
|
|
|
|
rtx result;
|
1993-06-20 00:32:28 +02:00
|
|
|
|
|
1999-10-19 10:12:30 +02:00
|
|
|
|
/* If the value is supposed to be returned in memory, then clearly
|
|
|
|
|
it is not returned in a stack register. */
|
|
|
|
|
if (aggregate_value_p (DECL_RESULT (decl)))
|
|
|
|
|
return 0;
|
|
|
|
|
|
varasm.c (assemble_alias): Use DECL_ASSEMBLER_NAME...
* varasm.c (assemble_alias): Use DECL_ASSEMBLER_NAME, not the
contents of the RTL, to determine the name of the object.
* tree.h (DECL_RTL): Allocate RTL lazily.
(SET_DECL_RTL): New macro.
(DECL_RTL_SET_P): Likewise.
(COPY_DECL_RTL): Likewise.
(DECL_RTL_IF_SET): Likewise.
* varasm.c (make_decl_rtl): Add assertions about the kind of
declaration we are processing.
* c-decl.c (duplicate_decls): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
(start_decl): Likewise.
(finish_decl): Likewise.
* c-semantics.c (emit_local_var): Likewise.
* calls.c (expand_call): Likewise.
* dbxout.c (dbxout_symbol): Likewise.
* emit-rtl.c (unshare_all_rtl): Likewise.
(unshare_all_decls): Likewise.
(reset_used_decls): Likewise.
* expr.c (store_constructor): Likewise.
(safe_from_p): Likewise.
(expand_expr): Likewise.
* function.c (put_var_into_stack): Likewise.
(instantiate_decls_1): Likewise.
(assign_parms): Likewise.
(expand_function_start): Likewise.
(expand_function_end): Likewise.
* ggc-common.c (gcc_mark_trees): Likewise.
* integrate.c (function_cannot_inline_p): Likewise.
(copy_decl_for_inlining): Likewise.
(expand_inline_function): Likewise.
(integrate_parm_decls): Likewise.
(integrate_decl_tree): Likewise.
* print-tree.c (print_node): Likewise.
* reg-stack.c (stack_result): Likewise.
* stmt.c (label_rtx): Likewise.
(expand_return): Likewise.
(expand_decl): Likewise.
(expand_decl_cleanup): Likewise.
(expand_anon_union_decl): Likewise.
* toplev.c (check_global_declarations): Likewise.
(rest_of_decl_compilation): Likewise.
* tree.c (simple_cst_equal): Likewise.
* objc/objc-act.c (generate_static_references): Likewise.
* class.c (build_clone): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
* cp-tree.h (DECL_IN_MEMORY_P): Likewise.
* decl.c (duplicate_decls): Likewise.
(builtin_function): Likewise.
(build_library_fn): Likewise.
(build_cp_library_fn): Likewise.
(check_initializer): Likewise.
(cp_finish_decl): Likewise.
* decl2.c (grokfield): Likewise.
(grok_function_init): Remove #if 0'd code.
(finish_anon_union): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
* friend.c (do_friend): Likewise.
* init.c (get_temp_regvar): Likewise.
* method.c (make_thunk): Likewise.
* pt.c (tsubst_friend_function): Likewise.
(tsubst_decl): Likewise.
(regenerate_decl_from_template): Likewise.
* semantics.c (genrtl_named_return_value): Likewise.
(expand_body): Likewise.
(genrtl_finish_function): Likewise.
* tree.c (cp_tree_equal): Likewise.
* com.c (ffecom_member_phase_2): Use COPY_DECL_RTL,
DECL_RTL_SET_P, etc.
(duplicate_decls): Likewise.
(start_decl): Likewise.
* class.c (build_static_field_ref): Likewise.
(make_method_value): Likewise.
(get_dispatch_table): Likewise.
* decl.c (push_jvm_slot): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
From-SVN: r40482
2001-03-15 03:51:03 +01:00
|
|
|
|
result = DECL_RTL_IF_SET (DECL_RESULT (decl));
|
2001-03-14 18:59:03 +01:00
|
|
|
|
if (result != 0)
|
1993-06-20 00:32:28 +02:00
|
|
|
|
{
|
|
|
|
|
#ifdef FUNCTION_OUTGOING_VALUE
|
|
|
|
|
result
|
2002-05-09 03:42:28 +02:00
|
|
|
|
= FUNCTION_OUTGOING_VALUE (TREE_TYPE (DECL_RESULT (decl)), decl);
|
1993-06-20 00:32:28 +02:00
|
|
|
|
#else
|
|
|
|
|
result = FUNCTION_VALUE (TREE_TYPE (DECL_RESULT (decl)), decl);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
1995-04-28 12:36:36 +02:00
|
|
|
|
return result != 0 && STACK_REG_P (result) ? result : 0;
|
1993-06-20 00:32:28 +02:00
|
|
|
|
}
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
|
1999-09-02 06:20:21 +02:00
|
|
|
|
/*
|
|
|
|
|
* This section deals with stack register substitution, and forms the second
|
|
|
|
|
* pass over the RTL.
|
|
|
|
|
*/
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
/* Replace REG, which is a pointer to a stack reg RTX, with an RTX for
|
1996-07-04 00:07:53 +02:00
|
|
|
|
the desired hard REGNO. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
replace_reg (reg, regno)
|
|
|
|
|
rtx *reg;
|
|
|
|
|
int regno;
|
|
|
|
|
{
|
|
|
|
|
if (regno < FIRST_STACK_REG || regno > LAST_STACK_REG
|
|
|
|
|
|| ! STACK_REG_P (*reg))
|
|
|
|
|
abort ();
|
|
|
|
|
|
1995-04-26 01:06:57 +02:00
|
|
|
|
switch (GET_MODE_CLASS (GET_MODE (*reg)))
|
1999-09-02 06:20:21 +02:00
|
|
|
|
{
|
|
|
|
|
default: abort ();
|
|
|
|
|
case MODE_FLOAT:
|
|
|
|
|
case MODE_COMPLEX_FLOAT:;
|
|
|
|
|
}
|
1992-01-08 12:09:52 +01:00
|
|
|
|
|
1995-04-26 01:06:57 +02:00
|
|
|
|
*reg = FP_MODE_REG (regno, GET_MODE (*reg));
|
1991-12-26 11:05:42 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Remove a note of type NOTE, which must be found, for register
|
1996-07-04 00:07:53 +02:00
|
|
|
|
number REGNO from INSN. Remove only one such note. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
remove_regno_note (insn, note, regno)
|
|
|
|
|
rtx insn;
|
|
|
|
|
enum reg_note note;
|
2001-02-17 10:55:46 +01:00
|
|
|
|
unsigned int regno;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
rtx *note_link, this;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
2002-01-15 14:38:03 +01:00
|
|
|
|
note_link = ®_NOTES (insn);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
for (this = *note_link; this; this = XEXP (this, 1))
|
|
|
|
|
if (REG_NOTE_KIND (this) == note
|
|
|
|
|
&& REG_P (XEXP (this, 0)) && REGNO (XEXP (this, 0)) == regno)
|
|
|
|
|
{
|
|
|
|
|
*note_link = XEXP (this, 1);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
note_link = &XEXP (this, 1);
|
|
|
|
|
|
|
|
|
|
abort ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Find the hard register number of virtual register REG in REGSTACK.
|
|
|
|
|
The hard register number is relative to the top of the stack. -1 is
|
1996-07-04 00:07:53 +02:00
|
|
|
|
returned if the register is not found. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
get_hard_regnum (regstack, reg)
|
|
|
|
|
stack regstack;
|
|
|
|
|
rtx reg;
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
if (! STACK_REG_P (reg))
|
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
|
|
for (i = regstack->top; i >= 0; i--)
|
|
|
|
|
if (regstack->reg[i] == REGNO (reg))
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
return i >= 0 ? (FIRST_STACK_REG + regstack->top - i) : -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Emit an insn to pop virtual register REG before or after INSN.
|
|
|
|
|
REGSTACK is the stack state after INSN and is updated to reflect this
|
1999-09-02 06:20:21 +02:00
|
|
|
|
pop. WHEN is either emit_insn_before or emit_insn_after. A pop insn
|
|
|
|
|
is represented as a SET whose destination is the register to be popped
|
|
|
|
|
and source is the top of stack. A death note for the top of stack
|
1996-07-04 00:07:53 +02:00
|
|
|
|
cases the movdf pattern to pop. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
static rtx
|
1999-10-27 03:25:13 +02:00
|
|
|
|
emit_pop_insn (insn, regstack, reg, where)
|
1991-12-26 11:05:42 +01:00
|
|
|
|
rtx insn;
|
|
|
|
|
stack regstack;
|
|
|
|
|
rtx reg;
|
1999-10-27 03:25:13 +02:00
|
|
|
|
enum emit_where where;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
{
|
|
|
|
|
rtx pop_insn, pop_rtx;
|
|
|
|
|
int hard_regno;
|
|
|
|
|
|
2001-04-11 14:10:22 +02:00
|
|
|
|
/* For complex types take care to pop both halves. These may survive in
|
|
|
|
|
CLOBBER and USE expressions. */
|
|
|
|
|
if (COMPLEX_MODE_P (GET_MODE (reg)))
|
|
|
|
|
{
|
|
|
|
|
rtx reg1 = FP_MODE_REG (REGNO (reg), DFmode);
|
|
|
|
|
rtx reg2 = FP_MODE_REG (REGNO (reg) + 1, DFmode);
|
|
|
|
|
|
|
|
|
|
pop_insn = NULL_RTX;
|
|
|
|
|
if (get_hard_regnum (regstack, reg1) >= 0)
|
2002-05-09 03:42:28 +02:00
|
|
|
|
pop_insn = emit_pop_insn (insn, regstack, reg1, where);
|
2001-04-11 14:10:22 +02:00
|
|
|
|
if (get_hard_regnum (regstack, reg2) >= 0)
|
2002-05-09 03:42:28 +02:00
|
|
|
|
pop_insn = emit_pop_insn (insn, regstack, reg2, where);
|
2001-04-11 14:10:22 +02:00
|
|
|
|
if (!pop_insn)
|
|
|
|
|
abort ();
|
|
|
|
|
return pop_insn;
|
|
|
|
|
}
|
|
|
|
|
|
1991-12-26 11:05:42 +01:00
|
|
|
|
hard_regno = get_hard_regnum (regstack, reg);
|
|
|
|
|
|
|
|
|
|
if (hard_regno < FIRST_STACK_REG)
|
|
|
|
|
abort ();
|
|
|
|
|
|
1999-09-02 06:20:21 +02:00
|
|
|
|
pop_rtx = gen_rtx_SET (VOIDmode, FP_MODE_REG (hard_regno, DFmode),
|
|
|
|
|
FP_MODE_REG (FIRST_STACK_REG, DFmode));
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
if (where == EMIT_AFTER)
|
2001-09-16 22:21:30 +02:00
|
|
|
|
pop_insn = emit_insn_after (pop_rtx, insn);
|
1999-10-27 03:25:13 +02:00
|
|
|
|
else
|
2001-09-16 22:21:30 +02:00
|
|
|
|
pop_insn = emit_insn_before (pop_rtx, insn);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-09-07 07:49:18 +02:00
|
|
|
|
REG_NOTES (pop_insn)
|
|
|
|
|
= gen_rtx_EXPR_LIST (REG_DEAD, FP_MODE_REG (FIRST_STACK_REG, DFmode),
|
|
|
|
|
REG_NOTES (pop_insn));
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
regstack->reg[regstack->top - (hard_regno - FIRST_STACK_REG)]
|
|
|
|
|
= regstack->reg[regstack->top];
|
|
|
|
|
regstack->top -= 1;
|
|
|
|
|
CLEAR_HARD_REG_BIT (regstack->reg_set, REGNO (reg));
|
|
|
|
|
|
|
|
|
|
return pop_insn;
|
|
|
|
|
}
|
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* Emit an insn before or after INSN to swap virtual register REG with
|
|
|
|
|
the top of stack. REGSTACK is the stack state before the swap, and
|
|
|
|
|
is updated to reflect the swap. A swap insn is represented as a
|
|
|
|
|
PARALLEL of two patterns: each pattern moves one reg to the other.
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
If REG is already at the top of the stack, no insn is emitted. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
static void
|
1993-01-20 07:39:06 +01:00
|
|
|
|
emit_swap_insn (insn, regstack, reg)
|
1991-12-26 11:05:42 +01:00
|
|
|
|
rtx insn;
|
|
|
|
|
stack regstack;
|
1993-01-20 07:39:06 +01:00
|
|
|
|
rtx reg;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
{
|
1993-01-20 07:39:06 +01:00
|
|
|
|
int hard_regno;
|
1999-10-27 03:25:13 +02:00
|
|
|
|
rtx swap_rtx;
|
1993-01-20 07:39:06 +01:00
|
|
|
|
int tmp, other_reg; /* swap regno temps */
|
|
|
|
|
rtx i1; /* the stack-reg insn prior to INSN */
|
|
|
|
|
rtx i1set = NULL_RTX; /* the SET rtx within I1 */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1993-01-20 07:39:06 +01:00
|
|
|
|
hard_regno = get_hard_regnum (regstack, reg);
|
|
|
|
|
|
|
|
|
|
if (hard_regno < FIRST_STACK_REG)
|
|
|
|
|
abort ();
|
1991-12-26 11:05:42 +01:00
|
|
|
|
if (hard_regno == FIRST_STACK_REG)
|
|
|
|
|
return;
|
|
|
|
|
|
1993-01-20 07:39:06 +01:00
|
|
|
|
other_reg = regstack->top - (hard_regno - FIRST_STACK_REG);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1993-01-20 07:39:06 +01:00
|
|
|
|
tmp = regstack->reg[other_reg];
|
|
|
|
|
regstack->reg[other_reg] = regstack->reg[regstack->top];
|
1991-12-26 11:05:42 +01:00
|
|
|
|
regstack->reg[regstack->top] = tmp;
|
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* Find the previous insn involving stack regs, but don't pass a
|
|
|
|
|
block boundary. */
|
|
|
|
|
i1 = NULL;
|
|
|
|
|
if (current_block && insn != current_block->head)
|
1993-01-20 07:39:06 +01:00
|
|
|
|
{
|
1999-10-27 03:25:13 +02:00
|
|
|
|
rtx tmp = PREV_INSN (insn);
|
2000-02-17 05:34:02 +01:00
|
|
|
|
rtx limit = PREV_INSN (current_block->head);
|
|
|
|
|
while (tmp != limit)
|
1999-10-27 03:25:13 +02:00
|
|
|
|
{
|
|
|
|
|
if (GET_CODE (tmp) == CODE_LABEL
|
2001-04-23 15:29:42 +02:00
|
|
|
|
|| GET_CODE (tmp) == CALL_INSN
|
2000-07-27 19:25:14 +02:00
|
|
|
|
|| NOTE_INSN_BASIC_BLOCK_P (tmp)
|
1999-10-27 03:25:13 +02:00
|
|
|
|
|| (GET_CODE (tmp) == INSN
|
|
|
|
|
&& stack_regs_mentioned (tmp)))
|
|
|
|
|
{
|
|
|
|
|
i1 = tmp;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
tmp = PREV_INSN (tmp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (i1 != NULL_RTX
|
|
|
|
|
&& (i1set = single_set (i1)) != NULL_RTX)
|
|
|
|
|
{
|
|
|
|
|
rtx i1src = *get_true_reg (&SET_SRC (i1set));
|
1993-01-20 07:39:06 +01:00
|
|
|
|
rtx i1dest = *get_true_reg (&SET_DEST (i1set));
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1993-01-20 07:39:06 +01:00
|
|
|
|
/* If the previous register stack push was from the reg we are to
|
1996-07-04 00:07:53 +02:00
|
|
|
|
swap with, omit the swap. */
|
1993-01-20 07:39:06 +01:00
|
|
|
|
|
|
|
|
|
if (GET_CODE (i1dest) == REG && REGNO (i1dest) == FIRST_STACK_REG
|
2001-07-10 12:38:10 +02:00
|
|
|
|
&& GET_CODE (i1src) == REG
|
|
|
|
|
&& REGNO (i1src) == (unsigned) hard_regno - 1
|
1993-01-20 07:39:06 +01:00
|
|
|
|
&& find_regno_note (i1, REG_DEAD, FIRST_STACK_REG) == NULL_RTX)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* If the previous insn wrote to the reg we are to swap with,
|
|
|
|
|
omit the swap. */
|
|
|
|
|
|
2001-07-10 12:38:10 +02:00
|
|
|
|
if (GET_CODE (i1dest) == REG && REGNO (i1dest) == (unsigned) hard_regno
|
1993-01-20 07:39:06 +01:00
|
|
|
|
&& GET_CODE (i1src) == REG && REGNO (i1src) == FIRST_STACK_REG
|
|
|
|
|
&& find_regno_note (i1, REG_DEAD, FIRST_STACK_REG) == NULL_RTX)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
1999-09-02 06:20:21 +02:00
|
|
|
|
swap_rtx = gen_swapxf (FP_MODE_REG (hard_regno, XFmode),
|
|
|
|
|
FP_MODE_REG (FIRST_STACK_REG, XFmode));
|
1999-10-27 03:25:13 +02:00
|
|
|
|
|
|
|
|
|
if (i1)
|
2001-09-16 22:21:30 +02:00
|
|
|
|
emit_insn_after (swap_rtx, i1);
|
1999-10-27 03:25:13 +02:00
|
|
|
|
else if (current_block)
|
2001-09-16 22:21:30 +02:00
|
|
|
|
emit_insn_before (swap_rtx, current_block->head);
|
1999-10-27 03:25:13 +02:00
|
|
|
|
else
|
|
|
|
|
emit_insn_before (swap_rtx, insn);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Handle a move to or from a stack register in PAT, which is in INSN.
|
1996-07-04 00:07:53 +02:00
|
|
|
|
REGSTACK is the current stack. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
move_for_stack_reg (insn, regstack, pat)
|
|
|
|
|
rtx insn;
|
|
|
|
|
stack regstack;
|
|
|
|
|
rtx pat;
|
|
|
|
|
{
|
1995-04-26 01:06:57 +02:00
|
|
|
|
rtx *psrc = get_true_reg (&SET_SRC (pat));
|
|
|
|
|
rtx *pdest = get_true_reg (&SET_DEST (pat));
|
|
|
|
|
rtx src, dest;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
rtx note;
|
|
|
|
|
|
1995-04-26 01:06:57 +02:00
|
|
|
|
src = *psrc; dest = *pdest;
|
|
|
|
|
|
|
|
|
|
if (STACK_REG_P (src) && STACK_REG_P (dest))
|
1991-12-26 11:05:42 +01:00
|
|
|
|
{
|
|
|
|
|
/* Write from one stack reg to another. If SRC dies here, then
|
1996-07-04 00:07:53 +02:00
|
|
|
|
just change the register mapping and delete the insn. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1995-04-26 01:06:57 +02:00
|
|
|
|
note = find_regno_note (insn, REG_DEAD, REGNO (src));
|
1991-12-26 11:05:42 +01:00
|
|
|
|
if (note)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* If this is a no-op move, there must not be a REG_DEAD note. */
|
1995-04-26 01:06:57 +02:00
|
|
|
|
if (REGNO (src) == REGNO (dest))
|
1991-12-26 11:05:42 +01:00
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
|
|
for (i = regstack->top; i >= 0; i--)
|
1995-04-26 01:06:57 +02:00
|
|
|
|
if (regstack->reg[i] == REGNO (src))
|
1991-12-26 11:05:42 +01:00
|
|
|
|
break;
|
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* The source must be live, and the dest must be dead. */
|
1995-04-26 01:06:57 +02:00
|
|
|
|
if (i < 0 || get_hard_regnum (regstack, dest) >= FIRST_STACK_REG)
|
1991-12-26 11:05:42 +01:00
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
|
|
/* It is possible that the dest is unused after this insn.
|
1996-07-04 00:07:53 +02:00
|
|
|
|
If so, just pop the src. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1995-04-26 01:06:57 +02:00
|
|
|
|
if (find_regno_note (insn, REG_UNUSED, REGNO (dest)))
|
1991-12-26 11:05:42 +01:00
|
|
|
|
{
|
1999-10-27 03:25:13 +02:00
|
|
|
|
emit_pop_insn (insn, regstack, src, EMIT_AFTER);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
basic-block.h (flow_delete_insn, [...]): Kill.
* basic-block.h (flow_delete_insn, flow_delete_insn_chain): Kill.
* cfg.c (delete_insn): Rename from ....; use remove_insn; do not
remove some labels.
(flow_delete_insn): This one.
(delete_insn_chain): Rename from ...; do not care labels.
(flow_delete_insn_chain): ... this one.
(flow_delete_block): Remove the insns one BB has been expunged.
(merge_blocks_nomove): Likewise.
(try_redirect_by_replacing_jump): Use delete_insn[_chain]; do not care
updating BB boundaries.
(tidy_fallthru_edge): Likewise.
(commit_one_edge_insertion): Likewise.
* cfgbuild.c (find_basic_block): Likewise.
(find_basic_blocks_1): Likewise.
* cfgcleanup.c (merge_blocks_move_predecessor_nojumps): Likewise.
(try_crossjump_to_edge): Likewise.
(try_optimize_cfg): Likewise.
* cse.c (delete_trivially_dead_insns): Likewise.
* df.c (df_insn_delete): Likewise.
* doloop.c (doloop_modify): Use delete_related_insns.
* emit-rtl.c (try_split): Likewise.
(remove_insn): Update BB boundaries.
* expect.c (connect_post_landing_pads): Use delete_related_insns.
* flow.c (delete_dead_jumptables): Use delete_insn[_chain]; do not care
updating BB boundaries.
(propagate_block_delete_insn): Likewise.
(propagate_block_delete_libcall): Likewise.
* function.c (delete_handlers): Use delete_related_insns.
(thread_prologue_and_epilogue_insns): Likewise.
* gcse.c (delete_null_pointer_checks): Use delete_related_insns.
* genpeep.c (gen_peephole): Use delete_related_insns.
* ifcvt.c (noce_process_if_block): Use delete_insn; do not care updating
BB boundaries.
(find_cond_trap): Likewise.
* integrate.c (save_for_inline): Use delete_related_insns.
(copy_insn_list): Likewise.
* jump.c (pruge_linie_number_notes): Likewise.
(duplicate_loop_exit_test): Likewise.
(delete_computation): Likewise.
(delete_related_insn): Rename from ...; use delete_insn
(delete_insn): ... this one.
(redirect_jump): Use delete_related_insns.
* loop.c (scan_loop): Likewise.
(move_movables): Likewise.
(find_and_verify_loops): Likewise.
(check_dbra_loop): Likewise.
* recog.c (peephole2_optimize): Likewise.
* reg-stack.c (delete_insn_for_stacker): Remove.
(move_for_stack_reg): Use delete_insn.
* regmove.c (combine_stack_adjustments_for_block): Likewise.
* reload1.c (delete_address_reloads): Use delete_related_insns.
(fixup_abnormal_edges): Use delete_insn.
* recog.c (emit_delay_sequence): Use delete_related_insns.
(delete_from-delay_slot): Likewise.
(delete_scheduled_jump): likewise.
(optimize_skip): Likewise.
(try_merge_delay_insns): Likewise.
(full_simple_delay_slots): Likewise.
(fill_slots_from_thread): Likewise.
(relax_delay_slots): Likewise.
(make_return_insns): Likewise.
(dbr_schedule): Likewise.
* rtl.h (delete_insn): Rename to delete_related_insns.
(delete_insn, delete_insn_chain): New prototypes.
* ssa-ccp (sse_fast_dce): Remove deleting of DEF, as it is done
by df_insn_delete already.
* ssa-dce.c (delete_insn_bb): Use delete_insn.
* ssa.c (convert_from_ssa): Use delete_related_insns.
* unroll.c (unroll_loop): Likewise.
(calculate_giv_inc): Likewise.
(copy_loop_body): Likewise.
* i386-protos.h (ix86_libcall_value, ix86_function_value,
ix86_function_arg_regno_p, ix86_function_arg_boundary,
ix86_return_in_memory, ix86_function_value): Declare.
* i386.c (x86_64_int_parameter_registers, x86_64_int_return_registers):
new static valurables.
(x86_64_reg_class): New enum
(x86_64_reg_class_name): New array.
(classify_argument, examine_argument, construct_container,
merge_classes): New static functions.
(optimization_options): Enable flag_omit_frame_pointer and disable
flag_pcc_struct_return on 64bit.
(ix86_libcall_value, ix86_function_value,
ix86_function_arg_regno_p, ix86_function_arg_boundary,
ix86_return_in_memory, ix86_function_value): New global functions.
(init_cumulative_args): Refuse regparm on x86_64, set maybe_vaarg.
(function_arg_advance): Handle x86_64 passing conventions.
(function_arg): Likewise.
* i386.h (FUNCTION_ARG_BOUNDARY): New macro.
(RETURN_IN_MEMORY): Move offline.
(FUNCTION_VALUE, LIBCALL_VALUE): Likewise.
(FUNCTION_VALUE_REGNO_P): New macro.
(FUNCTION_ARG_REGNO_P): Move offline.
(struct ix86_args): Add maybe_vaarg.
* next.h (FUNCTION_VALUE_REGNO_P): Delete.
* unix.h (FUNCTION_VALUE_REGNO_P): Delete.
From-SVN: r45726
2001-09-21 14:55:18 +02:00
|
|
|
|
delete_insn (insn);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
1995-04-26 01:06:57 +02:00
|
|
|
|
regstack->reg[i] = REGNO (dest);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1995-04-26 01:06:57 +02:00
|
|
|
|
SET_HARD_REG_BIT (regstack->reg_set, REGNO (dest));
|
|
|
|
|
CLEAR_HARD_REG_BIT (regstack->reg_set, REGNO (src));
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
basic-block.h (flow_delete_insn, [...]): Kill.
* basic-block.h (flow_delete_insn, flow_delete_insn_chain): Kill.
* cfg.c (delete_insn): Rename from ....; use remove_insn; do not
remove some labels.
(flow_delete_insn): This one.
(delete_insn_chain): Rename from ...; do not care labels.
(flow_delete_insn_chain): ... this one.
(flow_delete_block): Remove the insns one BB has been expunged.
(merge_blocks_nomove): Likewise.
(try_redirect_by_replacing_jump): Use delete_insn[_chain]; do not care
updating BB boundaries.
(tidy_fallthru_edge): Likewise.
(commit_one_edge_insertion): Likewise.
* cfgbuild.c (find_basic_block): Likewise.
(find_basic_blocks_1): Likewise.
* cfgcleanup.c (merge_blocks_move_predecessor_nojumps): Likewise.
(try_crossjump_to_edge): Likewise.
(try_optimize_cfg): Likewise.
* cse.c (delete_trivially_dead_insns): Likewise.
* df.c (df_insn_delete): Likewise.
* doloop.c (doloop_modify): Use delete_related_insns.
* emit-rtl.c (try_split): Likewise.
(remove_insn): Update BB boundaries.
* expect.c (connect_post_landing_pads): Use delete_related_insns.
* flow.c (delete_dead_jumptables): Use delete_insn[_chain]; do not care
updating BB boundaries.
(propagate_block_delete_insn): Likewise.
(propagate_block_delete_libcall): Likewise.
* function.c (delete_handlers): Use delete_related_insns.
(thread_prologue_and_epilogue_insns): Likewise.
* gcse.c (delete_null_pointer_checks): Use delete_related_insns.
* genpeep.c (gen_peephole): Use delete_related_insns.
* ifcvt.c (noce_process_if_block): Use delete_insn; do not care updating
BB boundaries.
(find_cond_trap): Likewise.
* integrate.c (save_for_inline): Use delete_related_insns.
(copy_insn_list): Likewise.
* jump.c (pruge_linie_number_notes): Likewise.
(duplicate_loop_exit_test): Likewise.
(delete_computation): Likewise.
(delete_related_insn): Rename from ...; use delete_insn
(delete_insn): ... this one.
(redirect_jump): Use delete_related_insns.
* loop.c (scan_loop): Likewise.
(move_movables): Likewise.
(find_and_verify_loops): Likewise.
(check_dbra_loop): Likewise.
* recog.c (peephole2_optimize): Likewise.
* reg-stack.c (delete_insn_for_stacker): Remove.
(move_for_stack_reg): Use delete_insn.
* regmove.c (combine_stack_adjustments_for_block): Likewise.
* reload1.c (delete_address_reloads): Use delete_related_insns.
(fixup_abnormal_edges): Use delete_insn.
* recog.c (emit_delay_sequence): Use delete_related_insns.
(delete_from-delay_slot): Likewise.
(delete_scheduled_jump): likewise.
(optimize_skip): Likewise.
(try_merge_delay_insns): Likewise.
(full_simple_delay_slots): Likewise.
(fill_slots_from_thread): Likewise.
(relax_delay_slots): Likewise.
(make_return_insns): Likewise.
(dbr_schedule): Likewise.
* rtl.h (delete_insn): Rename to delete_related_insns.
(delete_insn, delete_insn_chain): New prototypes.
* ssa-ccp (sse_fast_dce): Remove deleting of DEF, as it is done
by df_insn_delete already.
* ssa-dce.c (delete_insn_bb): Use delete_insn.
* ssa.c (convert_from_ssa): Use delete_related_insns.
* unroll.c (unroll_loop): Likewise.
(calculate_giv_inc): Likewise.
(copy_loop_body): Likewise.
* i386-protos.h (ix86_libcall_value, ix86_function_value,
ix86_function_arg_regno_p, ix86_function_arg_boundary,
ix86_return_in_memory, ix86_function_value): Declare.
* i386.c (x86_64_int_parameter_registers, x86_64_int_return_registers):
new static valurables.
(x86_64_reg_class): New enum
(x86_64_reg_class_name): New array.
(classify_argument, examine_argument, construct_container,
merge_classes): New static functions.
(optimization_options): Enable flag_omit_frame_pointer and disable
flag_pcc_struct_return on 64bit.
(ix86_libcall_value, ix86_function_value,
ix86_function_arg_regno_p, ix86_function_arg_boundary,
ix86_return_in_memory, ix86_function_value): New global functions.
(init_cumulative_args): Refuse regparm on x86_64, set maybe_vaarg.
(function_arg_advance): Handle x86_64 passing conventions.
(function_arg): Likewise.
* i386.h (FUNCTION_ARG_BOUNDARY): New macro.
(RETURN_IN_MEMORY): Move offline.
(FUNCTION_VALUE, LIBCALL_VALUE): Likewise.
(FUNCTION_VALUE_REGNO_P): New macro.
(FUNCTION_ARG_REGNO_P): Move offline.
(struct ix86_args): Add maybe_vaarg.
* next.h (FUNCTION_VALUE_REGNO_P): Delete.
* unix.h (FUNCTION_VALUE_REGNO_P): Delete.
From-SVN: r45726
2001-09-21 14:55:18 +02:00
|
|
|
|
delete_insn (insn);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* The source reg does not die. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
/* If this appears to be a no-op move, delete it, or else it
|
|
|
|
|
will confuse the machine description output patterns. But if
|
|
|
|
|
it is REG_UNUSED, we must pop the reg now, as per-insn processing
|
1996-07-04 00:07:53 +02:00
|
|
|
|
for REG_UNUSED will not work for deleted insns. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1995-04-26 01:06:57 +02:00
|
|
|
|
if (REGNO (src) == REGNO (dest))
|
1991-12-26 11:05:42 +01:00
|
|
|
|
{
|
1995-04-26 01:06:57 +02:00
|
|
|
|
if (find_regno_note (insn, REG_UNUSED, REGNO (dest)))
|
1999-10-27 03:25:13 +02:00
|
|
|
|
emit_pop_insn (insn, regstack, dest, EMIT_AFTER);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
basic-block.h (flow_delete_insn, [...]): Kill.
* basic-block.h (flow_delete_insn, flow_delete_insn_chain): Kill.
* cfg.c (delete_insn): Rename from ....; use remove_insn; do not
remove some labels.
(flow_delete_insn): This one.
(delete_insn_chain): Rename from ...; do not care labels.
(flow_delete_insn_chain): ... this one.
(flow_delete_block): Remove the insns one BB has been expunged.
(merge_blocks_nomove): Likewise.
(try_redirect_by_replacing_jump): Use delete_insn[_chain]; do not care
updating BB boundaries.
(tidy_fallthru_edge): Likewise.
(commit_one_edge_insertion): Likewise.
* cfgbuild.c (find_basic_block): Likewise.
(find_basic_blocks_1): Likewise.
* cfgcleanup.c (merge_blocks_move_predecessor_nojumps): Likewise.
(try_crossjump_to_edge): Likewise.
(try_optimize_cfg): Likewise.
* cse.c (delete_trivially_dead_insns): Likewise.
* df.c (df_insn_delete): Likewise.
* doloop.c (doloop_modify): Use delete_related_insns.
* emit-rtl.c (try_split): Likewise.
(remove_insn): Update BB boundaries.
* expect.c (connect_post_landing_pads): Use delete_related_insns.
* flow.c (delete_dead_jumptables): Use delete_insn[_chain]; do not care
updating BB boundaries.
(propagate_block_delete_insn): Likewise.
(propagate_block_delete_libcall): Likewise.
* function.c (delete_handlers): Use delete_related_insns.
(thread_prologue_and_epilogue_insns): Likewise.
* gcse.c (delete_null_pointer_checks): Use delete_related_insns.
* genpeep.c (gen_peephole): Use delete_related_insns.
* ifcvt.c (noce_process_if_block): Use delete_insn; do not care updating
BB boundaries.
(find_cond_trap): Likewise.
* integrate.c (save_for_inline): Use delete_related_insns.
(copy_insn_list): Likewise.
* jump.c (pruge_linie_number_notes): Likewise.
(duplicate_loop_exit_test): Likewise.
(delete_computation): Likewise.
(delete_related_insn): Rename from ...; use delete_insn
(delete_insn): ... this one.
(redirect_jump): Use delete_related_insns.
* loop.c (scan_loop): Likewise.
(move_movables): Likewise.
(find_and_verify_loops): Likewise.
(check_dbra_loop): Likewise.
* recog.c (peephole2_optimize): Likewise.
* reg-stack.c (delete_insn_for_stacker): Remove.
(move_for_stack_reg): Use delete_insn.
* regmove.c (combine_stack_adjustments_for_block): Likewise.
* reload1.c (delete_address_reloads): Use delete_related_insns.
(fixup_abnormal_edges): Use delete_insn.
* recog.c (emit_delay_sequence): Use delete_related_insns.
(delete_from-delay_slot): Likewise.
(delete_scheduled_jump): likewise.
(optimize_skip): Likewise.
(try_merge_delay_insns): Likewise.
(full_simple_delay_slots): Likewise.
(fill_slots_from_thread): Likewise.
(relax_delay_slots): Likewise.
(make_return_insns): Likewise.
(dbr_schedule): Likewise.
* rtl.h (delete_insn): Rename to delete_related_insns.
(delete_insn, delete_insn_chain): New prototypes.
* ssa-ccp (sse_fast_dce): Remove deleting of DEF, as it is done
by df_insn_delete already.
* ssa-dce.c (delete_insn_bb): Use delete_insn.
* ssa.c (convert_from_ssa): Use delete_related_insns.
* unroll.c (unroll_loop): Likewise.
(calculate_giv_inc): Likewise.
(copy_loop_body): Likewise.
* i386-protos.h (ix86_libcall_value, ix86_function_value,
ix86_function_arg_regno_p, ix86_function_arg_boundary,
ix86_return_in_memory, ix86_function_value): Declare.
* i386.c (x86_64_int_parameter_registers, x86_64_int_return_registers):
new static valurables.
(x86_64_reg_class): New enum
(x86_64_reg_class_name): New array.
(classify_argument, examine_argument, construct_container,
merge_classes): New static functions.
(optimization_options): Enable flag_omit_frame_pointer and disable
flag_pcc_struct_return on 64bit.
(ix86_libcall_value, ix86_function_value,
ix86_function_arg_regno_p, ix86_function_arg_boundary,
ix86_return_in_memory, ix86_function_value): New global functions.
(init_cumulative_args): Refuse regparm on x86_64, set maybe_vaarg.
(function_arg_advance): Handle x86_64 passing conventions.
(function_arg): Likewise.
* i386.h (FUNCTION_ARG_BOUNDARY): New macro.
(RETURN_IN_MEMORY): Move offline.
(FUNCTION_VALUE, LIBCALL_VALUE): Likewise.
(FUNCTION_VALUE_REGNO_P): New macro.
(FUNCTION_ARG_REGNO_P): Move offline.
(struct ix86_args): Add maybe_vaarg.
* next.h (FUNCTION_VALUE_REGNO_P): Delete.
* unix.h (FUNCTION_VALUE_REGNO_P): Delete.
From-SVN: r45726
2001-09-21 14:55:18 +02:00
|
|
|
|
delete_insn (insn);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* The destination ought to be dead */
|
1995-04-26 01:06:57 +02:00
|
|
|
|
if (get_hard_regnum (regstack, dest) >= FIRST_STACK_REG)
|
1991-12-26 11:05:42 +01:00
|
|
|
|
abort ();
|
|
|
|
|
|
1995-04-26 01:06:57 +02:00
|
|
|
|
replace_reg (psrc, get_hard_regnum (regstack, src));
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1995-04-26 01:06:57 +02:00
|
|
|
|
regstack->reg[++regstack->top] = REGNO (dest);
|
|
|
|
|
SET_HARD_REG_BIT (regstack->reg_set, REGNO (dest));
|
|
|
|
|
replace_reg (pdest, FIRST_STACK_REG);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
}
|
1995-04-26 01:06:57 +02:00
|
|
|
|
else if (STACK_REG_P (src))
|
1991-12-26 11:05:42 +01:00
|
|
|
|
{
|
|
|
|
|
/* Save from a stack reg to MEM, or possibly integer reg. Since
|
|
|
|
|
only top of stack may be saved, emit an exchange first if
|
1996-07-04 00:07:53 +02:00
|
|
|
|
needs be. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1995-04-26 01:06:57 +02:00
|
|
|
|
emit_swap_insn (insn, regstack, src);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1995-04-26 01:06:57 +02:00
|
|
|
|
note = find_regno_note (insn, REG_DEAD, REGNO (src));
|
1991-12-26 11:05:42 +01:00
|
|
|
|
if (note)
|
|
|
|
|
{
|
|
|
|
|
replace_reg (&XEXP (note, 0), FIRST_STACK_REG);
|
|
|
|
|
regstack->top--;
|
1995-04-26 01:06:57 +02:00
|
|
|
|
CLEAR_HARD_REG_BIT (regstack->reg_set, REGNO (src));
|
1991-12-26 11:05:42 +01:00
|
|
|
|
}
|
2001-03-08 20:09:03 +01:00
|
|
|
|
else if ((GET_MODE (src) == XFmode || GET_MODE (src) == TFmode)
|
|
|
|
|
&& regstack->top < REG_STACK_SIZE - 1)
|
1993-10-05 06:48:02 +01:00
|
|
|
|
{
|
|
|
|
|
/* A 387 cannot write an XFmode value to a MEM without
|
|
|
|
|
clobbering the source reg. The output code can handle
|
|
|
|
|
this by reading back the value from the MEM.
|
|
|
|
|
But it is more efficient to use a temp register if one is
|
|
|
|
|
available. Push the source value here if the register
|
|
|
|
|
stack is not full, and then write the value to memory via
|
|
|
|
|
a pop. */
|
|
|
|
|
rtx push_rtx, push_insn;
|
2001-04-11 14:10:22 +02:00
|
|
|
|
rtx top_stack_reg = FP_MODE_REG (FIRST_STACK_REG, GET_MODE (src));
|
1993-10-05 06:48:02 +01:00
|
|
|
|
|
2001-04-11 14:10:22 +02:00
|
|
|
|
if (GET_MODE (src) == TFmode)
|
|
|
|
|
push_rtx = gen_movtf (top_stack_reg, top_stack_reg);
|
|
|
|
|
else
|
|
|
|
|
push_rtx = gen_movxf (top_stack_reg, top_stack_reg);
|
1993-10-05 06:48:02 +01:00
|
|
|
|
push_insn = emit_insn_before (push_rtx, insn);
|
alias.c: Change all uses of gen_rtx(FOO...) to gen_rtx_FOO...
* alias.c: Change all uses of gen_rtx(FOO...) to gen_rtx_FOO;
change gen_rtx(expr...) to gen_rtx_fmt_foo(expr...).
* caller-save.c, calls.c, combine.c, cse.c: Likewise.
* dwarf2out.c, except.c, explow.c, expmed.c, expr.c: Likewise.
* final.c, flow.c, function.c, genpeep.c, haifa-sched.c: Likewise.
* halfpic.c, integrate.c, jump.c, local-alloc.c, loop.c: Likewise.
* profile.c, recog.c, reg-stack.c, regclass.c, regmove.c: Likewise.
* reload.c, reload1.c, reorg.c, sched.c, stmt.c, stupid.c: Likewise.
* unroll.c, varasm.c: Likewise.
* config/alpha/alpha.c, config/alpha/alpha.md: Likewise.
From-SVN: r17357
1998-01-15 00:10:50 +01:00
|
|
|
|
REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_DEAD, top_stack_reg,
|
|
|
|
|
REG_NOTES (insn));
|
1993-10-05 06:48:02 +01:00
|
|
|
|
}
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1995-04-26 01:06:57 +02:00
|
|
|
|
replace_reg (psrc, FIRST_STACK_REG);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
}
|
1995-04-26 01:06:57 +02:00
|
|
|
|
else if (STACK_REG_P (dest))
|
1991-12-26 11:05:42 +01:00
|
|
|
|
{
|
|
|
|
|
/* Load from MEM, or possibly integer REG or constant, into the
|
|
|
|
|
stack regs. The actual target is always the top of the
|
|
|
|
|
stack. The stack mapping is changed to reflect that DEST is
|
|
|
|
|
now at top of stack. */
|
|
|
|
|
|
|
|
|
|
/* The destination ought to be dead */
|
1995-04-26 01:06:57 +02:00
|
|
|
|
if (get_hard_regnum (regstack, dest) >= FIRST_STACK_REG)
|
1991-12-26 11:05:42 +01:00
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
|
|
if (regstack->top >= REG_STACK_SIZE)
|
|
|
|
|
abort ();
|
|
|
|
|
|
1995-04-26 01:06:57 +02:00
|
|
|
|
regstack->reg[++regstack->top] = REGNO (dest);
|
|
|
|
|
SET_HARD_REG_BIT (regstack->reg_set, REGNO (dest));
|
|
|
|
|
replace_reg (pdest, FIRST_STACK_REG);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
abort ();
|
|
|
|
|
}
|
|
|
|
|
|
1999-09-02 06:20:21 +02:00
|
|
|
|
/* Swap the condition on a branch, if there is one. Return true if we
|
|
|
|
|
found a condition to swap. False if the condition was not used as
|
2001-08-13 01:40:53 +02:00
|
|
|
|
such. */
|
1999-09-02 06:20:21 +02:00
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
swap_rtx_condition_1 (pat)
|
1993-01-20 07:39:06 +01:00
|
|
|
|
rtx pat;
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
const char *fmt;
|
|
|
|
|
int i, r = 0;
|
1993-01-20 07:39:06 +01:00
|
|
|
|
|
|
|
|
|
if (GET_RTX_CLASS (GET_CODE (pat)) == '<')
|
|
|
|
|
{
|
|
|
|
|
PUT_CODE (pat, swap_condition (GET_CODE (pat)));
|
1999-09-02 06:20:21 +02:00
|
|
|
|
r = 1;
|
1993-01-20 07:39:06 +01:00
|
|
|
|
}
|
1999-09-02 06:20:21 +02:00
|
|
|
|
else
|
1993-01-20 07:39:06 +01:00
|
|
|
|
{
|
1999-09-02 06:20:21 +02:00
|
|
|
|
fmt = GET_RTX_FORMAT (GET_CODE (pat));
|
|
|
|
|
for (i = GET_RTX_LENGTH (GET_CODE (pat)) - 1; i >= 0; i--)
|
1993-01-20 07:39:06 +01:00
|
|
|
|
{
|
1999-09-02 06:20:21 +02:00
|
|
|
|
if (fmt[i] == 'E')
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
int j;
|
1993-01-20 07:39:06 +01:00
|
|
|
|
|
1999-09-02 06:20:21 +02:00
|
|
|
|
for (j = XVECLEN (pat, i) - 1; j >= 0; j--)
|
|
|
|
|
r |= swap_rtx_condition_1 (XVECEXP (pat, i, j));
|
|
|
|
|
}
|
|
|
|
|
else if (fmt[i] == 'e')
|
|
|
|
|
r |= swap_rtx_condition_1 (XEXP (pat, i));
|
1993-01-20 07:39:06 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
1999-09-02 06:20:21 +02:00
|
|
|
|
|
|
|
|
|
return r;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
swap_rtx_condition (insn)
|
|
|
|
|
rtx insn;
|
|
|
|
|
{
|
|
|
|
|
rtx pat = PATTERN (insn);
|
|
|
|
|
|
|
|
|
|
/* We're looking for a single set to cc0 or an HImode temporary. */
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (pat) == SET
|
|
|
|
|
&& GET_CODE (SET_DEST (pat)) == REG
|
|
|
|
|
&& REGNO (SET_DEST (pat)) == FLAGS_REG)
|
|
|
|
|
{
|
|
|
|
|
insn = next_flags_user (insn);
|
|
|
|
|
if (insn == NULL_RTX)
|
|
|
|
|
return 0;
|
|
|
|
|
pat = PATTERN (insn);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* See if this is, or ends in, a fnstsw, aka unspec 9. If so, we're
|
|
|
|
|
not doing anything with the cc value right now. We may be able to
|
|
|
|
|
search for one though. */
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (pat) == SET
|
|
|
|
|
&& GET_CODE (SET_SRC (pat)) == UNSPEC
|
2002-05-21 21:57:39 +02:00
|
|
|
|
&& XINT (SET_SRC (pat), 1) == UNSPEC_FNSTSW)
|
1999-09-02 06:20:21 +02:00
|
|
|
|
{
|
|
|
|
|
rtx dest = SET_DEST (pat);
|
|
|
|
|
|
2002-05-09 03:42:28 +02:00
|
|
|
|
/* Search forward looking for the first use of this value.
|
1999-09-02 06:20:21 +02:00
|
|
|
|
Stop at block boundaries. */
|
2001-02-19 15:59:42 +01:00
|
|
|
|
while (insn != current_block->end)
|
1999-09-02 06:20:21 +02:00
|
|
|
|
{
|
|
|
|
|
insn = NEXT_INSN (insn);
|
2000-08-04 22:28:08 +02:00
|
|
|
|
if (INSN_P (insn) && reg_mentioned_p (dest, insn))
|
1999-09-02 06:20:21 +02:00
|
|
|
|
break;
|
2001-02-19 15:59:42 +01:00
|
|
|
|
if (GET_CODE (insn) == CALL_INSN)
|
1999-09-02 06:20:21 +02:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* So we've found the insn using this value. If it is anything
|
|
|
|
|
other than sahf, aka unspec 10, or the value does not die
|
|
|
|
|
(meaning we'd have to search further), then we must give up. */
|
|
|
|
|
pat = PATTERN (insn);
|
|
|
|
|
if (GET_CODE (pat) != SET
|
|
|
|
|
|| GET_CODE (SET_SRC (pat)) != UNSPEC
|
2002-05-21 21:57:39 +02:00
|
|
|
|
|| XINT (SET_SRC (pat), 1) != UNSPEC_SAHF
|
1999-09-02 06:20:21 +02:00
|
|
|
|
|| ! dead_or_set_p (insn, dest))
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
/* Now we are prepared to handle this as a normal cc0 setter. */
|
|
|
|
|
insn = next_flags_user (insn);
|
|
|
|
|
if (insn == NULL_RTX)
|
|
|
|
|
return 0;
|
|
|
|
|
pat = PATTERN (insn);
|
|
|
|
|
}
|
|
|
|
|
|
2001-01-05 16:34:39 +01:00
|
|
|
|
if (swap_rtx_condition_1 (pat))
|
|
|
|
|
{
|
2001-02-19 15:59:42 +01:00
|
|
|
|
int fail = 0;
|
2001-01-05 16:34:39 +01:00
|
|
|
|
INSN_CODE (insn) = -1;
|
|
|
|
|
if (recog_memoized (insn) == -1)
|
2001-02-19 15:59:42 +01:00
|
|
|
|
fail = 1;
|
|
|
|
|
/* In case the flags don't die here, recurse to try fix
|
|
|
|
|
following user too. */
|
|
|
|
|
else if (! dead_or_set_p (insn, ix86_flags_rtx))
|
|
|
|
|
{
|
|
|
|
|
insn = next_flags_user (insn);
|
|
|
|
|
if (!insn || !swap_rtx_condition (insn))
|
|
|
|
|
fail = 1;
|
|
|
|
|
}
|
|
|
|
|
if (fail)
|
2001-01-05 16:34:39 +01:00
|
|
|
|
{
|
|
|
|
|
swap_rtx_condition_1 (pat);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
1993-01-20 07:39:06 +01:00
|
|
|
|
}
|
|
|
|
|
|
1991-12-26 11:05:42 +01:00
|
|
|
|
/* Handle a comparison. Special care needs to be taken to avoid
|
|
|
|
|
causing comparisons that a 387 cannot do correctly, such as EQ.
|
|
|
|
|
|
1999-09-02 06:20:21 +02:00
|
|
|
|
Also, a pop insn may need to be emitted. The 387 does have an
|
1991-12-26 11:05:42 +01:00
|
|
|
|
`fcompp' insn that can pop two regs, but it is sometimes too expensive
|
|
|
|
|
to do this - a `fcomp' followed by a `fstpl %st(0)' may be easier to
|
1999-09-02 06:20:21 +02:00
|
|
|
|
set up. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
static void
|
1999-09-02 06:20:21 +02:00
|
|
|
|
compare_for_stack_reg (insn, regstack, pat_src)
|
1991-12-26 11:05:42 +01:00
|
|
|
|
rtx insn;
|
|
|
|
|
stack regstack;
|
1999-09-02 06:20:21 +02:00
|
|
|
|
rtx pat_src;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
{
|
|
|
|
|
rtx *src1, *src2;
|
|
|
|
|
rtx src1_note, src2_note;
|
1999-09-02 06:20:21 +02:00
|
|
|
|
rtx flags_user;
|
1997-09-05 07:14:46 +02:00
|
|
|
|
|
1999-09-02 06:20:21 +02:00
|
|
|
|
src1 = get_true_reg (&XEXP (pat_src, 0));
|
|
|
|
|
src2 = get_true_reg (&XEXP (pat_src, 1));
|
|
|
|
|
flags_user = next_flags_user (insn);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1993-01-20 07:39:06 +01:00
|
|
|
|
/* ??? If fxch turns out to be cheaper than fstp, give priority to
|
1996-07-04 00:07:53 +02:00
|
|
|
|
registers that die in this insn - move those to stack top first. */
|
1999-09-02 06:20:21 +02:00
|
|
|
|
if ((! STACK_REG_P (*src1)
|
|
|
|
|
|| (STACK_REG_P (*src2)
|
|
|
|
|
&& get_hard_regnum (regstack, *src2) == FIRST_STACK_REG))
|
|
|
|
|
&& swap_rtx_condition (insn))
|
1993-01-20 07:39:06 +01:00
|
|
|
|
{
|
1999-09-02 06:20:21 +02:00
|
|
|
|
rtx temp;
|
|
|
|
|
temp = XEXP (pat_src, 0);
|
|
|
|
|
XEXP (pat_src, 0) = XEXP (pat_src, 1);
|
|
|
|
|
XEXP (pat_src, 1) = temp;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-09-02 06:20:21 +02:00
|
|
|
|
src1 = get_true_reg (&XEXP (pat_src, 0));
|
|
|
|
|
src2 = get_true_reg (&XEXP (pat_src, 1));
|
1993-01-29 06:48:47 +01:00
|
|
|
|
|
1993-03-12 10:27:29 +01:00
|
|
|
|
INSN_CODE (insn) = -1;
|
1993-01-20 07:39:06 +01:00
|
|
|
|
}
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* We will fix any death note later. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
src1_note = find_regno_note (insn, REG_DEAD, REGNO (*src1));
|
|
|
|
|
|
|
|
|
|
if (STACK_REG_P (*src2))
|
|
|
|
|
src2_note = find_regno_note (insn, REG_DEAD, REGNO (*src2));
|
|
|
|
|
else
|
1993-01-20 07:39:06 +01:00
|
|
|
|
src2_note = NULL_RTX;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-09-02 06:20:21 +02:00
|
|
|
|
emit_swap_insn (insn, regstack, *src1);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
replace_reg (src1, FIRST_STACK_REG);
|
|
|
|
|
|
|
|
|
|
if (STACK_REG_P (*src2))
|
1999-09-02 06:20:21 +02:00
|
|
|
|
replace_reg (src2, get_hard_regnum (regstack, *src2));
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
if (src1_note)
|
|
|
|
|
{
|
1998-03-20 09:28:06 +01:00
|
|
|
|
pop_stack (regstack, REGNO (XEXP (src1_note, 0)));
|
1991-12-26 11:05:42 +01:00
|
|
|
|
replace_reg (&XEXP (src1_note, 0), FIRST_STACK_REG);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If the second operand dies, handle that. But if the operands are
|
|
|
|
|
the same stack register, don't bother, because only one death is
|
1996-07-04 00:07:53 +02:00
|
|
|
|
needed, and it was just handled. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
if (src2_note
|
1993-01-20 07:39:06 +01:00
|
|
|
|
&& ! (STACK_REG_P (*src1) && STACK_REG_P (*src2)
|
1991-12-26 11:05:42 +01:00
|
|
|
|
&& REGNO (*src1) == REGNO (*src2)))
|
|
|
|
|
{
|
|
|
|
|
/* As a special case, two regs may die in this insn if src2 is
|
|
|
|
|
next to top of stack and the top of stack also dies. Since
|
|
|
|
|
we have already popped src1, "next to top of stack" is really
|
1996-07-04 00:07:53 +02:00
|
|
|
|
at top (FIRST_STACK_REG) now. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
if (get_hard_regnum (regstack, XEXP (src2_note, 0)) == FIRST_STACK_REG
|
|
|
|
|
&& src1_note)
|
|
|
|
|
{
|
1998-03-20 09:28:06 +01:00
|
|
|
|
pop_stack (regstack, REGNO (XEXP (src2_note, 0)));
|
1991-12-26 11:05:42 +01:00
|
|
|
|
replace_reg (&XEXP (src2_note, 0), FIRST_STACK_REG + 1);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
1999-09-02 06:20:21 +02:00
|
|
|
|
/* The 386 can only represent death of the first operand in
|
|
|
|
|
the case handled above. In all other cases, emit a separate
|
|
|
|
|
pop and remove the death note from here. */
|
|
|
|
|
|
|
|
|
|
/* link_cc0_insns (insn); */
|
|
|
|
|
|
|
|
|
|
remove_regno_note (insn, REG_DEAD, REGNO (XEXP (src2_note, 0)));
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-09-02 06:20:21 +02:00
|
|
|
|
emit_pop_insn (insn, regstack, XEXP (src2_note, 0),
|
1999-10-27 03:25:13 +02:00
|
|
|
|
EMIT_AFTER);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Substitute new registers in PAT, which is part of INSN. REGSTACK
|
1996-07-04 00:07:53 +02:00
|
|
|
|
is the current register layout. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
subst_stack_regs_pat (insn, regstack, pat)
|
|
|
|
|
rtx insn;
|
|
|
|
|
stack regstack;
|
|
|
|
|
rtx pat;
|
|
|
|
|
{
|
|
|
|
|
rtx *dest, *src;
|
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
switch (GET_CODE (pat))
|
|
|
|
|
{
|
|
|
|
|
case USE:
|
|
|
|
|
/* Deaths in USE insns can happen in non optimizing compilation.
|
|
|
|
|
Handle them by popping the dying register. */
|
|
|
|
|
src = get_true_reg (&XEXP (pat, 0));
|
2002-05-09 03:42:28 +02:00
|
|
|
|
if (STACK_REG_P (*src)
|
|
|
|
|
&& find_regno_note (insn, REG_DEAD, REGNO (*src)))
|
|
|
|
|
{
|
|
|
|
|
emit_pop_insn (insn, regstack, *src, EMIT_AFTER);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2000-01-24 19:58:32 +01:00
|
|
|
|
/* ??? Uninitialized USE should not happen. */
|
1999-10-27 03:25:13 +02:00
|
|
|
|
else if (get_hard_regnum (regstack, *src) == -1)
|
2002-01-10 01:56:56 +01:00
|
|
|
|
abort ();
|
1999-10-27 03:25:13 +02:00
|
|
|
|
break;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
case CLOBBER:
|
|
|
|
|
{
|
|
|
|
|
rtx note;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
dest = get_true_reg (&XEXP (pat, 0));
|
|
|
|
|
if (STACK_REG_P (*dest))
|
|
|
|
|
{
|
|
|
|
|
note = find_reg_note (insn, REG_DEAD, *dest);
|
1999-11-05 01:35:10 +01:00
|
|
|
|
|
|
|
|
|
if (pat != PATTERN (insn))
|
|
|
|
|
{
|
|
|
|
|
/* The fix_truncdi_1 pattern wants to be able to allocate
|
|
|
|
|
it's own scratch register. It does this by clobbering
|
|
|
|
|
an fp reg so that it is assured of an empty reg-stack
|
2002-05-09 03:42:28 +02:00
|
|
|
|
register. If the register is live, kill it now.
|
1999-11-05 01:35:10 +01:00
|
|
|
|
Remove the DEAD/UNUSED note so we don't try to kill it
|
|
|
|
|
later too. */
|
|
|
|
|
|
|
|
|
|
if (note)
|
|
|
|
|
emit_pop_insn (insn, regstack, *dest, EMIT_BEFORE);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
note = find_reg_note (insn, REG_UNUSED, *dest);
|
|
|
|
|
if (!note)
|
|
|
|
|
abort ();
|
|
|
|
|
}
|
|
|
|
|
remove_note (insn, note);
|
|
|
|
|
replace_reg (dest, LAST_STACK_REG);
|
|
|
|
|
}
|
1999-10-27 03:25:13 +02:00
|
|
|
|
else
|
|
|
|
|
{
|
1999-11-05 01:35:10 +01:00
|
|
|
|
/* A top-level clobber with no REG_DEAD, and no hard-regnum
|
|
|
|
|
indicates an uninitialized value. Because reload removed
|
2002-05-09 03:42:28 +02:00
|
|
|
|
all other clobbers, this must be due to a function
|
1999-11-05 01:35:10 +01:00
|
|
|
|
returning without a value. Load up a NaN. */
|
|
|
|
|
|
|
|
|
|
if (! note
|
|
|
|
|
&& get_hard_regnum (regstack, *dest) == -1)
|
|
|
|
|
{
|
|
|
|
|
pat = gen_rtx_SET (VOIDmode,
|
|
|
|
|
FP_MODE_REG (REGNO (*dest), SFmode),
|
|
|
|
|
nan);
|
|
|
|
|
PATTERN (insn) = pat;
|
|
|
|
|
move_for_stack_reg (insn, regstack, pat);
|
|
|
|
|
}
|
2001-04-11 14:10:22 +02:00
|
|
|
|
if (! note && COMPLEX_MODE_P (GET_MODE (*dest))
|
|
|
|
|
&& get_hard_regnum (regstack, FP_MODE_REG (REGNO (*dest), DFmode)) == -1)
|
|
|
|
|
{
|
|
|
|
|
pat = gen_rtx_SET (VOIDmode,
|
|
|
|
|
FP_MODE_REG (REGNO (*dest) + 1, SFmode),
|
|
|
|
|
nan);
|
|
|
|
|
PATTERN (insn) = pat;
|
|
|
|
|
move_for_stack_reg (insn, regstack, pat);
|
|
|
|
|
}
|
1999-10-27 03:25:13 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
1991-12-26 11:05:42 +01:00
|
|
|
|
break;
|
1999-10-27 03:25:13 +02:00
|
|
|
|
}
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
case SET:
|
|
|
|
|
{
|
2001-05-01 14:11:35 +02:00
|
|
|
|
rtx *src1 = (rtx *) 0, *src2;
|
1999-10-27 03:25:13 +02:00
|
|
|
|
rtx src1_note, src2_note;
|
|
|
|
|
rtx pat_src;
|
|
|
|
|
|
|
|
|
|
dest = get_true_reg (&SET_DEST (pat));
|
|
|
|
|
src = get_true_reg (&SET_SRC (pat));
|
|
|
|
|
pat_src = SET_SRC (pat);
|
|
|
|
|
|
|
|
|
|
/* See if this is a `movM' pattern, and handle elsewhere if so. */
|
|
|
|
|
if (STACK_REG_P (*src)
|
|
|
|
|
|| (STACK_REG_P (*dest)
|
|
|
|
|
&& (GET_CODE (*src) == REG || GET_CODE (*src) == MEM
|
|
|
|
|
|| GET_CODE (*src) == CONST_DOUBLE)))
|
|
|
|
|
{
|
|
|
|
|
move_for_stack_reg (insn, regstack, pat);
|
|
|
|
|
break;
|
|
|
|
|
}
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
switch (GET_CODE (pat_src))
|
|
|
|
|
{
|
|
|
|
|
case COMPARE:
|
|
|
|
|
compare_for_stack_reg (insn, regstack, pat_src);
|
|
|
|
|
break;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
case CALL:
|
|
|
|
|
{
|
|
|
|
|
int count;
|
|
|
|
|
for (count = HARD_REGNO_NREGS (REGNO (*dest), GET_MODE (*dest));
|
|
|
|
|
--count >= 0;)
|
|
|
|
|
{
|
|
|
|
|
regstack->reg[++regstack->top] = REGNO (*dest) + count;
|
|
|
|
|
SET_HARD_REG_BIT (regstack->reg_set, REGNO (*dest) + count);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
replace_reg (dest, FIRST_STACK_REG);
|
|
|
|
|
break;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
case REG:
|
|
|
|
|
/* This is a `tstM2' case. */
|
|
|
|
|
if (*dest != cc0_rtx)
|
|
|
|
|
abort ();
|
|
|
|
|
src1 = src;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* Fall through. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
case FLOAT_TRUNCATE:
|
|
|
|
|
case SQRT:
|
|
|
|
|
case ABS:
|
|
|
|
|
case NEG:
|
|
|
|
|
/* These insns only operate on the top of the stack. DEST might
|
|
|
|
|
be cc0_rtx if we're processing a tstM pattern. Also, it's
|
|
|
|
|
possible that the tstM case results in a REG_DEAD note on the
|
|
|
|
|
source. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
if (src1 == 0)
|
|
|
|
|
src1 = get_true_reg (&XEXP (pat_src, 0));
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
emit_swap_insn (insn, regstack, *src1);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
src1_note = find_regno_note (insn, REG_DEAD, REGNO (*src1));
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
if (STACK_REG_P (*dest))
|
|
|
|
|
replace_reg (dest, FIRST_STACK_REG);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
if (src1_note)
|
|
|
|
|
{
|
|
|
|
|
replace_reg (&XEXP (src1_note, 0), FIRST_STACK_REG);
|
|
|
|
|
regstack->top--;
|
|
|
|
|
CLEAR_HARD_REG_BIT (regstack->reg_set, REGNO (*src1));
|
|
|
|
|
}
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
replace_reg (src1, FIRST_STACK_REG);
|
|
|
|
|
break;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
case MINUS:
|
|
|
|
|
case DIV:
|
|
|
|
|
/* On i386, reversed forms of subM3 and divM3 exist for
|
|
|
|
|
MODE_FLOAT, so the same code that works for addM3 and mulM3
|
|
|
|
|
can be used. */
|
|
|
|
|
case MULT:
|
|
|
|
|
case PLUS:
|
|
|
|
|
/* These insns can accept the top of stack as a destination
|
|
|
|
|
from a stack reg or mem, or can use the top of stack as a
|
|
|
|
|
source and some other stack register (possibly top of stack)
|
|
|
|
|
as a destination. */
|
|
|
|
|
|
|
|
|
|
src1 = get_true_reg (&XEXP (pat_src, 0));
|
|
|
|
|
src2 = get_true_reg (&XEXP (pat_src, 1));
|
|
|
|
|
|
|
|
|
|
/* We will fix any death note later. */
|
|
|
|
|
|
|
|
|
|
if (STACK_REG_P (*src1))
|
|
|
|
|
src1_note = find_regno_note (insn, REG_DEAD, REGNO (*src1));
|
|
|
|
|
else
|
|
|
|
|
src1_note = NULL_RTX;
|
|
|
|
|
if (STACK_REG_P (*src2))
|
|
|
|
|
src2_note = find_regno_note (insn, REG_DEAD, REGNO (*src2));
|
|
|
|
|
else
|
|
|
|
|
src2_note = NULL_RTX;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* If either operand is not a stack register, then the dest
|
|
|
|
|
must be top of stack. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
if (! STACK_REG_P (*src1) || ! STACK_REG_P (*src2))
|
1993-01-20 07:39:06 +01:00
|
|
|
|
emit_swap_insn (insn, regstack, *dest);
|
1999-10-27 03:25:13 +02:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Both operands are REG. If neither operand is already
|
|
|
|
|
at the top of stack, choose to make the one that is the dest
|
|
|
|
|
the new top of stack. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
int src1_hard_regnum, src2_hard_regnum;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
src1_hard_regnum = get_hard_regnum (regstack, *src1);
|
|
|
|
|
src2_hard_regnum = get_hard_regnum (regstack, *src2);
|
|
|
|
|
if (src1_hard_regnum == -1 || src2_hard_regnum == -1)
|
|
|
|
|
abort ();
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
if (src1_hard_regnum != FIRST_STACK_REG
|
|
|
|
|
&& src2_hard_regnum != FIRST_STACK_REG)
|
|
|
|
|
emit_swap_insn (insn, regstack, *dest);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
}
|
1999-10-27 03:25:13 +02:00
|
|
|
|
|
|
|
|
|
if (STACK_REG_P (*src1))
|
|
|
|
|
replace_reg (src1, get_hard_regnum (regstack, *src1));
|
|
|
|
|
if (STACK_REG_P (*src2))
|
|
|
|
|
replace_reg (src2, get_hard_regnum (regstack, *src2));
|
|
|
|
|
|
|
|
|
|
if (src1_note)
|
1991-12-26 11:05:42 +01:00
|
|
|
|
{
|
1999-10-27 03:25:13 +02:00
|
|
|
|
rtx src1_reg = XEXP (src1_note, 0);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* If the register that dies is at the top of stack, then
|
|
|
|
|
the destination is somewhere else - merely substitute it.
|
|
|
|
|
But if the reg that dies is not at top of stack, then
|
|
|
|
|
move the top of stack to the dead reg, as though we had
|
|
|
|
|
done the insn and then a store-with-pop. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
if (REGNO (src1_reg) == regstack->reg[regstack->top])
|
|
|
|
|
{
|
|
|
|
|
SET_HARD_REG_BIT (regstack->reg_set, REGNO (*dest));
|
|
|
|
|
replace_reg (dest, get_hard_regnum (regstack, *dest));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int regno = get_hard_regnum (regstack, src1_reg);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
SET_HARD_REG_BIT (regstack->reg_set, REGNO (*dest));
|
|
|
|
|
replace_reg (dest, regno);
|
|
|
|
|
|
|
|
|
|
regstack->reg[regstack->top - (regno - FIRST_STACK_REG)]
|
|
|
|
|
= regstack->reg[regstack->top];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CLEAR_HARD_REG_BIT (regstack->reg_set,
|
|
|
|
|
REGNO (XEXP (src1_note, 0)));
|
|
|
|
|
replace_reg (&XEXP (src1_note, 0), FIRST_STACK_REG);
|
|
|
|
|
regstack->top--;
|
|
|
|
|
}
|
|
|
|
|
else if (src2_note)
|
1991-12-26 11:05:42 +01:00
|
|
|
|
{
|
1999-10-27 03:25:13 +02:00
|
|
|
|
rtx src2_reg = XEXP (src2_note, 0);
|
|
|
|
|
if (REGNO (src2_reg) == regstack->reg[regstack->top])
|
|
|
|
|
{
|
|
|
|
|
SET_HARD_REG_BIT (regstack->reg_set, REGNO (*dest));
|
|
|
|
|
replace_reg (dest, get_hard_regnum (regstack, *dest));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int regno = get_hard_regnum (regstack, src2_reg);
|
|
|
|
|
|
|
|
|
|
SET_HARD_REG_BIT (regstack->reg_set, REGNO (*dest));
|
|
|
|
|
replace_reg (dest, regno);
|
|
|
|
|
|
|
|
|
|
regstack->reg[regstack->top - (regno - FIRST_STACK_REG)]
|
|
|
|
|
= regstack->reg[regstack->top];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CLEAR_HARD_REG_BIT (regstack->reg_set,
|
|
|
|
|
REGNO (XEXP (src2_note, 0)));
|
|
|
|
|
replace_reg (&XEXP (src2_note, 0), FIRST_STACK_REG);
|
|
|
|
|
regstack->top--;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SET_HARD_REG_BIT (regstack->reg_set, REGNO (*dest));
|
1999-10-27 03:25:13 +02:00
|
|
|
|
replace_reg (dest, get_hard_regnum (regstack, *dest));
|
1991-12-26 11:05:42 +01:00
|
|
|
|
}
|
1999-11-25 13:53:44 +01:00
|
|
|
|
|
|
|
|
|
/* Keep operand 1 maching with destination. */
|
|
|
|
|
if (GET_RTX_CLASS (GET_CODE (pat_src)) == 'c'
|
|
|
|
|
&& REG_P (*src1) && REG_P (*src2)
|
|
|
|
|
&& REGNO (*src1) != REGNO (*dest))
|
|
|
|
|
{
|
2000-08-03 20:36:14 +02:00
|
|
|
|
int tmp = REGNO (*src1);
|
|
|
|
|
replace_reg (src1, REGNO (*src2));
|
|
|
|
|
replace_reg (src2, tmp);
|
1999-11-25 13:53:44 +01:00
|
|
|
|
}
|
1999-10-27 03:25:13 +02:00
|
|
|
|
break;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
case UNSPEC:
|
|
|
|
|
switch (XINT (pat_src, 1))
|
|
|
|
|
{
|
2002-05-21 21:57:39 +02:00
|
|
|
|
case UNSPEC_SIN:
|
|
|
|
|
case UNSPEC_COS:
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* These insns only operate on the top of the stack. */
|
1992-08-28 03:24:42 +02:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
src1 = get_true_reg (&XVECEXP (pat_src, 0, 0));
|
1992-08-28 03:24:42 +02:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
emit_swap_insn (insn, regstack, *src1);
|
1992-08-28 03:24:42 +02:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
src1_note = find_regno_note (insn, REG_DEAD, REGNO (*src1));
|
1992-08-28 03:24:42 +02:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
if (STACK_REG_P (*dest))
|
|
|
|
|
replace_reg (dest, FIRST_STACK_REG);
|
1992-08-28 03:24:42 +02:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
if (src1_note)
|
|
|
|
|
{
|
|
|
|
|
replace_reg (&XEXP (src1_note, 0), FIRST_STACK_REG);
|
|
|
|
|
regstack->top--;
|
|
|
|
|
CLEAR_HARD_REG_BIT (regstack->reg_set, REGNO (*src1));
|
|
|
|
|
}
|
1992-08-28 03:24:42 +02:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
replace_reg (src1, FIRST_STACK_REG);
|
|
|
|
|
break;
|
1992-08-28 03:24:42 +02:00
|
|
|
|
|
2002-05-21 21:57:39 +02:00
|
|
|
|
case UNSPEC_SAHF:
|
|
|
|
|
/* (unspec [(unspec [(compare)] UNSPEC_FNSTSW)] UNSPEC_SAHF)
|
|
|
|
|
The combination matches the PPRO fcomi instruction. */
|
1992-08-28 03:24:42 +02:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
pat_src = XVECEXP (pat_src, 0, 0);
|
|
|
|
|
if (GET_CODE (pat_src) != UNSPEC
|
2002-05-21 21:57:39 +02:00
|
|
|
|
|| XINT (pat_src, 1) != UNSPEC_FNSTSW)
|
1999-10-27 03:25:13 +02:00
|
|
|
|
abort ();
|
|
|
|
|
/* FALLTHRU */
|
1999-09-02 06:20:21 +02:00
|
|
|
|
|
2002-05-21 21:57:39 +02:00
|
|
|
|
case UNSPEC_FNSTSW:
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* Combined fcomp+fnstsw generated for doing well with
|
|
|
|
|
CSE. When optimizing this would have been broken
|
|
|
|
|
up before now. */
|
1999-09-02 06:20:21 +02:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
pat_src = XVECEXP (pat_src, 0, 0);
|
|
|
|
|
if (GET_CODE (pat_src) != COMPARE)
|
|
|
|
|
abort ();
|
1999-09-02 06:20:21 +02:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
compare_for_stack_reg (insn, regstack, pat_src);
|
|
|
|
|
break;
|
1999-09-02 06:20:21 +02:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
default:
|
|
|
|
|
abort ();
|
|
|
|
|
}
|
1999-09-02 06:20:21 +02:00
|
|
|
|
break;
|
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
case IF_THEN_ELSE:
|
2001-08-13 01:40:53 +02:00
|
|
|
|
/* This insn requires the top of stack to be the destination. */
|
1992-08-28 03:24:42 +02:00
|
|
|
|
|
2001-09-05 17:32:12 +02:00
|
|
|
|
src1 = get_true_reg (&XEXP (pat_src, 1));
|
|
|
|
|
src2 = get_true_reg (&XEXP (pat_src, 2));
|
|
|
|
|
|
|
|
|
|
src1_note = find_regno_note (insn, REG_DEAD, REGNO (*src1));
|
|
|
|
|
src2_note = find_regno_note (insn, REG_DEAD, REGNO (*src2));
|
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* If the comparison operator is an FP comparison operator,
|
|
|
|
|
it is handled correctly by compare_for_stack_reg () who
|
|
|
|
|
will move the destination to the top of stack. But if the
|
|
|
|
|
comparison operator is not an FP comparison operator, we
|
2001-08-13 01:40:53 +02:00
|
|
|
|
have to handle it here. */
|
1999-10-27 03:25:13 +02:00
|
|
|
|
if (get_hard_regnum (regstack, *dest) >= FIRST_STACK_REG
|
|
|
|
|
&& REGNO (*dest) != regstack->reg[regstack->top])
|
2001-09-05 17:32:12 +02:00
|
|
|
|
{
|
|
|
|
|
/* In case one of operands is the top of stack and the operands
|
2002-05-21 21:57:39 +02:00
|
|
|
|
dies, it is safe to make it the destination operand by
|
|
|
|
|
reversing the direction of cmove and avoid fxch. */
|
2001-09-05 17:32:12 +02:00
|
|
|
|
if ((REGNO (*src1) == regstack->reg[regstack->top]
|
|
|
|
|
&& src1_note)
|
|
|
|
|
|| (REGNO (*src2) == regstack->reg[regstack->top]
|
|
|
|
|
&& src2_note))
|
|
|
|
|
{
|
2001-09-08 22:01:54 +02:00
|
|
|
|
int idx1 = (get_hard_regnum (regstack, *src1)
|
|
|
|
|
- FIRST_STACK_REG);
|
|
|
|
|
int idx2 = (get_hard_regnum (regstack, *src2)
|
|
|
|
|
- FIRST_STACK_REG);
|
|
|
|
|
|
|
|
|
|
/* Make reg-stack believe that the operands are already
|
|
|
|
|
swapped on the stack */
|
|
|
|
|
regstack->reg[regstack->top - idx1] = REGNO (*src2);
|
|
|
|
|
regstack->reg[regstack->top - idx2] = REGNO (*src1);
|
|
|
|
|
|
|
|
|
|
/* Reverse condition to compensate the operand swap.
|
|
|
|
|
i386 do have comparison always reversible. */
|
2001-09-05 17:32:12 +02:00
|
|
|
|
PUT_CODE (XEXP (pat_src, 0),
|
|
|
|
|
reversed_comparison_code (XEXP (pat_src, 0), insn));
|
|
|
|
|
}
|
|
|
|
|
else
|
2002-05-09 03:42:28 +02:00
|
|
|
|
emit_swap_insn (insn, regstack, *dest);
|
2001-09-05 17:32:12 +02:00
|
|
|
|
}
|
1996-11-08 23:03:06 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
{
|
|
|
|
|
rtx src_note [3];
|
|
|
|
|
int i;
|
1996-11-08 23:03:06 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
src_note[0] = 0;
|
|
|
|
|
src_note[1] = src1_note;
|
|
|
|
|
src_note[2] = src2_note;
|
1996-12-30 20:55:54 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
if (STACK_REG_P (*src1))
|
|
|
|
|
replace_reg (src1, get_hard_regnum (regstack, *src1));
|
|
|
|
|
if (STACK_REG_P (*src2))
|
|
|
|
|
replace_reg (src2, get_hard_regnum (regstack, *src2));
|
1996-11-08 23:03:06 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
for (i = 1; i <= 2; i++)
|
|
|
|
|
if (src_note [i])
|
1996-11-08 23:03:06 +01:00
|
|
|
|
{
|
1999-10-27 03:25:13 +02:00
|
|
|
|
int regno = REGNO (XEXP (src_note[i], 0));
|
|
|
|
|
|
|
|
|
|
/* If the register that dies is not at the top of
|
|
|
|
|
stack, then move the top of stack to the dead reg */
|
|
|
|
|
if (regno != regstack->reg[regstack->top])
|
|
|
|
|
{
|
|
|
|
|
remove_regno_note (insn, REG_DEAD, regno);
|
|
|
|
|
emit_pop_insn (insn, regstack, XEXP (src_note[i], 0),
|
|
|
|
|
EMIT_AFTER);
|
|
|
|
|
}
|
|
|
|
|
else
|
2001-09-08 22:01:54 +02:00
|
|
|
|
/* Top of stack never dies, as it is the
|
|
|
|
|
destination. */
|
|
|
|
|
abort ();
|
1996-11-08 23:03:06 +01:00
|
|
|
|
}
|
1999-10-27 03:25:13 +02:00
|
|
|
|
}
|
1996-11-08 23:03:06 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* Make dest the top of stack. Add dest to regstack if
|
2001-08-13 01:40:53 +02:00
|
|
|
|
not present. */
|
1999-10-27 03:25:13 +02:00
|
|
|
|
if (get_hard_regnum (regstack, *dest) < FIRST_STACK_REG)
|
2002-05-09 03:42:28 +02:00
|
|
|
|
regstack->reg[++regstack->top] = REGNO (*dest);
|
1999-10-27 03:25:13 +02:00
|
|
|
|
SET_HARD_REG_BIT (regstack->reg_set, REGNO (*dest));
|
|
|
|
|
replace_reg (dest, FIRST_STACK_REG);
|
|
|
|
|
break;
|
1997-09-05 07:14:46 +02:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
default:
|
|
|
|
|
abort ();
|
|
|
|
|
}
|
1996-11-08 23:03:06 +01:00
|
|
|
|
break;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
}
|
1999-10-27 03:25:13 +02:00
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
1991-12-26 11:05:42 +01:00
|
|
|
|
}
|
|
|
|
|
|
1992-01-19 05:23:39 +01:00
|
|
|
|
/* Substitute hard regnums for any stack regs in INSN, which has
|
|
|
|
|
N_INPUTS inputs and N_OUTPUTS outputs. REGSTACK is the stack info
|
1998-12-04 13:55:59 +01:00
|
|
|
|
before the insn, and is updated with changes made here.
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
|
|
|
|
There are several requirements and assumptions about the use of
|
|
|
|
|
stack-like regs in asm statements. These rules are enforced by
|
|
|
|
|
record_asm_stack_regs; see comments there for details. Any
|
|
|
|
|
asm_operands left in the RTL at this point may be assume to meet the
|
1998-04-27 21:24:06 +02:00
|
|
|
|
requirements, since record_asm_stack_regs removes any problem asm. */
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
1998-04-27 21:24:06 +02:00
|
|
|
|
static void
|
1998-12-04 13:55:59 +01:00
|
|
|
|
subst_asm_stack_regs (insn, regstack)
|
1992-01-19 05:23:39 +01:00
|
|
|
|
rtx insn;
|
|
|
|
|
stack regstack;
|
|
|
|
|
{
|
|
|
|
|
rtx body = PATTERN (insn);
|
1998-12-04 13:55:59 +01:00
|
|
|
|
int alt;
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
|
|
|
|
rtx *note_reg; /* Array of note contents */
|
|
|
|
|
rtx **note_loc; /* Address of REG field of each note */
|
|
|
|
|
enum reg_note *note_kind; /* The type of each note */
|
|
|
|
|
|
2000-01-04 17:29:41 +01:00
|
|
|
|
rtx *clobber_reg = 0;
|
|
|
|
|
rtx **clobber_loc = 0;
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
|
|
|
|
struct stack_def temp_stack;
|
|
|
|
|
int n_notes;
|
|
|
|
|
int n_clobbers;
|
|
|
|
|
rtx note;
|
|
|
|
|
int i;
|
1998-12-04 13:55:59 +01:00
|
|
|
|
int n_inputs, n_outputs;
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
if (! check_asm_stack_operands (insn))
|
|
|
|
|
return;
|
|
|
|
|
|
1992-01-19 05:23:39 +01:00
|
|
|
|
/* Find out what the constraints required. If no constraint
|
|
|
|
|
alternative matches, that is a compiler bug: we should have caught
|
1999-10-27 03:25:13 +02:00
|
|
|
|
such an insn in check_asm_stack_operands. */
|
1998-12-04 13:55:59 +01:00
|
|
|
|
extract_insn (insn);
|
|
|
|
|
constrain_operands (1);
|
|
|
|
|
alt = which_alternative;
|
|
|
|
|
|
|
|
|
|
preprocess_constraints ();
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
1998-12-04 13:55:59 +01:00
|
|
|
|
n_inputs = get_asm_operand_n_inputs (body);
|
1999-09-12 03:51:28 +02:00
|
|
|
|
n_outputs = recog_data.n_operands - n_inputs;
|
2002-05-09 03:42:28 +02:00
|
|
|
|
|
1998-12-04 13:55:59 +01:00
|
|
|
|
if (alt < 0)
|
1992-01-19 05:23:39 +01:00
|
|
|
|
abort ();
|
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* Strip SUBREGs here to make the following code simpler. */
|
1999-09-12 03:51:28 +02:00
|
|
|
|
for (i = 0; i < recog_data.n_operands; i++)
|
|
|
|
|
if (GET_CODE (recog_data.operand[i]) == SUBREG
|
|
|
|
|
&& GET_CODE (SUBREG_REG (recog_data.operand[i])) == REG)
|
1992-01-19 05:23:39 +01:00
|
|
|
|
{
|
1999-09-12 03:51:28 +02:00
|
|
|
|
recog_data.operand_loc[i] = & SUBREG_REG (recog_data.operand[i]);
|
|
|
|
|
recog_data.operand[i] = SUBREG_REG (recog_data.operand[i]);
|
1992-01-19 05:23:39 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Set up NOTE_REG, NOTE_LOC and NOTE_KIND. */
|
|
|
|
|
|
|
|
|
|
for (i = 0, note = REG_NOTES (insn); note; note = XEXP (note, 1))
|
|
|
|
|
i++;
|
|
|
|
|
|
|
|
|
|
note_reg = (rtx *) alloca (i * sizeof (rtx));
|
|
|
|
|
note_loc = (rtx **) alloca (i * sizeof (rtx *));
|
|
|
|
|
note_kind = (enum reg_note *) alloca (i * sizeof (enum reg_note));
|
|
|
|
|
|
|
|
|
|
n_notes = 0;
|
|
|
|
|
for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
|
|
|
|
|
{
|
|
|
|
|
rtx reg = XEXP (note, 0);
|
|
|
|
|
rtx *loc = & XEXP (note, 0);
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (reg) == SUBREG && GET_CODE (SUBREG_REG (reg)) == REG)
|
|
|
|
|
{
|
|
|
|
|
loc = & SUBREG_REG (reg);
|
|
|
|
|
reg = SUBREG_REG (reg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (STACK_REG_P (reg)
|
|
|
|
|
&& (REG_NOTE_KIND (note) == REG_DEAD
|
|
|
|
|
|| REG_NOTE_KIND (note) == REG_UNUSED))
|
|
|
|
|
{
|
|
|
|
|
note_reg[n_notes] = reg;
|
|
|
|
|
note_loc[n_notes] = loc;
|
|
|
|
|
note_kind[n_notes] = REG_NOTE_KIND (note);
|
|
|
|
|
n_notes++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Set up CLOBBER_REG and CLOBBER_LOC. */
|
|
|
|
|
|
|
|
|
|
n_clobbers = 0;
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (body) == PARALLEL)
|
1992-03-21 05:53:32 +01:00
|
|
|
|
{
|
1998-10-09 18:08:51 +02:00
|
|
|
|
clobber_reg = (rtx *) alloca (XVECLEN (body, 0) * sizeof (rtx));
|
|
|
|
|
clobber_loc = (rtx **) alloca (XVECLEN (body, 0) * sizeof (rtx *));
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
1992-03-21 05:53:32 +01:00
|
|
|
|
for (i = 0; i < XVECLEN (body, 0); i++)
|
|
|
|
|
if (GET_CODE (XVECEXP (body, 0, i)) == CLOBBER)
|
|
|
|
|
{
|
|
|
|
|
rtx clobber = XVECEXP (body, 0, i);
|
|
|
|
|
rtx reg = XEXP (clobber, 0);
|
|
|
|
|
rtx *loc = & XEXP (clobber, 0);
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
1992-03-21 05:53:32 +01:00
|
|
|
|
if (GET_CODE (reg) == SUBREG && GET_CODE (SUBREG_REG (reg)) == REG)
|
|
|
|
|
{
|
|
|
|
|
loc = & SUBREG_REG (reg);
|
|
|
|
|
reg = SUBREG_REG (reg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (STACK_REG_P (reg))
|
|
|
|
|
{
|
|
|
|
|
clobber_reg[n_clobbers] = reg;
|
|
|
|
|
clobber_loc[n_clobbers] = loc;
|
|
|
|
|
n_clobbers++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
temp_stack = *regstack;
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
|
|
|
|
/* Put the input regs into the desired place in TEMP_STACK. */
|
|
|
|
|
|
1998-12-04 13:55:59 +01:00
|
|
|
|
for (i = n_outputs; i < n_outputs + n_inputs; i++)
|
1999-09-12 03:51:28 +02:00
|
|
|
|
if (STACK_REG_P (recog_data.operand[i])
|
1998-12-04 13:55:59 +01:00
|
|
|
|
&& reg_class_subset_p (recog_op_alt[i][alt].class,
|
|
|
|
|
FLOAT_REGS)
|
|
|
|
|
&& recog_op_alt[i][alt].class != FLOAT_REGS)
|
1992-01-19 05:23:39 +01:00
|
|
|
|
{
|
|
|
|
|
/* If an operand needs to be in a particular reg in
|
|
|
|
|
FLOAT_REGS, the constraint was either 't' or 'u'. Since
|
1999-09-12 03:51:28 +02:00
|
|
|
|
these constraints are for single register classes, and
|
|
|
|
|
reload guaranteed that operand[i] is already in that class,
|
|
|
|
|
we can just use REGNO (recog_data.operand[i]) to know which
|
|
|
|
|
actual reg this operand needs to be in. */
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
1999-09-12 03:51:28 +02:00
|
|
|
|
int regno = get_hard_regnum (&temp_stack, recog_data.operand[i]);
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
|
|
|
|
if (regno < 0)
|
|
|
|
|
abort ();
|
|
|
|
|
|
2001-07-10 12:38:10 +02:00
|
|
|
|
if ((unsigned int) regno != REGNO (recog_data.operand[i]))
|
1992-01-19 05:23:39 +01:00
|
|
|
|
{
|
1999-09-12 03:51:28 +02:00
|
|
|
|
/* recog_data.operand[i] is not in the right place. Find
|
|
|
|
|
it and swap it with whatever is already in I's place.
|
|
|
|
|
K is where recog_data.operand[i] is now. J is where it
|
|
|
|
|
should be. */
|
1992-01-19 05:23:39 +01:00
|
|
|
|
int j, k, temp;
|
|
|
|
|
|
|
|
|
|
k = temp_stack.top - (regno - FIRST_STACK_REG);
|
|
|
|
|
j = (temp_stack.top
|
1999-09-12 03:51:28 +02:00
|
|
|
|
- (REGNO (recog_data.operand[i]) - FIRST_STACK_REG));
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
|
|
|
|
temp = temp_stack.reg[k];
|
|
|
|
|
temp_stack.reg[k] = temp_stack.reg[j];
|
|
|
|
|
temp_stack.reg[j] = temp;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* Emit insns before INSN to make sure the reg-stack is in the right
|
1992-01-19 05:23:39 +01:00
|
|
|
|
order. */
|
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
change_stack (insn, regstack, &temp_stack, EMIT_BEFORE);
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
|
|
|
|
/* Make the needed input register substitutions. Do death notes and
|
1996-07-04 00:07:53 +02:00
|
|
|
|
clobbers too, because these are for inputs, not outputs. */
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
1998-12-04 13:55:59 +01:00
|
|
|
|
for (i = n_outputs; i < n_outputs + n_inputs; i++)
|
1999-09-12 03:51:28 +02:00
|
|
|
|
if (STACK_REG_P (recog_data.operand[i]))
|
1992-01-19 05:23:39 +01:00
|
|
|
|
{
|
1999-09-12 03:51:28 +02:00
|
|
|
|
int regnum = get_hard_regnum (regstack, recog_data.operand[i]);
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
|
|
|
|
if (regnum < 0)
|
|
|
|
|
abort ();
|
|
|
|
|
|
1999-09-12 03:51:28 +02:00
|
|
|
|
replace_reg (recog_data.operand_loc[i], regnum);
|
1992-01-19 05:23:39 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < n_notes; i++)
|
|
|
|
|
if (note_kind[i] == REG_DEAD)
|
|
|
|
|
{
|
|
|
|
|
int regnum = get_hard_regnum (regstack, note_reg[i]);
|
|
|
|
|
|
|
|
|
|
if (regnum < 0)
|
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
|
|
replace_reg (note_loc[i], regnum);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < n_clobbers; i++)
|
|
|
|
|
{
|
|
|
|
|
/* It's OK for a CLOBBER to reference a reg that is not live.
|
|
|
|
|
Don't try to replace it in that case. */
|
|
|
|
|
int regnum = get_hard_regnum (regstack, clobber_reg[i]);
|
|
|
|
|
|
|
|
|
|
if (regnum >= 0)
|
|
|
|
|
{
|
|
|
|
|
/* Sigh - clobbers always have QImode. But replace_reg knows
|
|
|
|
|
that these regs can't be MODE_INT and will abort. Just put
|
|
|
|
|
the right reg there without calling replace_reg. */
|
|
|
|
|
|
1995-04-26 01:06:57 +02:00
|
|
|
|
*clobber_loc[i] = FP_MODE_REG (regnum, DFmode);
|
1992-01-19 05:23:39 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* Now remove from REGSTACK any inputs that the asm implicitly popped. */
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
1998-12-04 13:55:59 +01:00
|
|
|
|
for (i = n_outputs; i < n_outputs + n_inputs; i++)
|
1999-09-12 03:51:28 +02:00
|
|
|
|
if (STACK_REG_P (recog_data.operand[i]))
|
1992-01-19 05:23:39 +01:00
|
|
|
|
{
|
|
|
|
|
/* An input reg is implicitly popped if it is tied to an
|
1996-07-04 00:07:53 +02:00
|
|
|
|
output, or if there is a CLOBBER for it. */
|
1992-01-19 05:23:39 +01:00
|
|
|
|
int j;
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < n_clobbers; j++)
|
1999-09-12 03:51:28 +02:00
|
|
|
|
if (operands_match_p (clobber_reg[j], recog_data.operand[i]))
|
1992-01-19 05:23:39 +01:00
|
|
|
|
break;
|
|
|
|
|
|
1998-12-04 13:55:59 +01:00
|
|
|
|
if (j < n_clobbers || recog_op_alt[i][alt].matches >= 0)
|
1992-01-19 05:23:39 +01:00
|
|
|
|
{
|
1999-09-12 03:51:28 +02:00
|
|
|
|
/* recog_data.operand[i] might not be at the top of stack.
|
|
|
|
|
But that's OK, because all we need to do is pop the
|
|
|
|
|
right number of regs off of the top of the reg-stack.
|
|
|
|
|
record_asm_stack_regs guaranteed that all implicitly
|
|
|
|
|
popped regs were grouped at the top of the reg-stack. */
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
|
|
|
|
CLEAR_HARD_REG_BIT (regstack->reg_set,
|
|
|
|
|
regstack->reg[regstack->top]);
|
|
|
|
|
regstack->top--;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Now add to REGSTACK any outputs that the asm implicitly pushed.
|
|
|
|
|
Note that there isn't any need to substitute register numbers.
|
1996-07-04 00:07:53 +02:00
|
|
|
|
??? Explain why this is true. */
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
|
|
|
|
for (i = LAST_STACK_REG; i >= FIRST_STACK_REG; i--)
|
|
|
|
|
{
|
|
|
|
|
/* See if there is an output for this hard reg. */
|
|
|
|
|
int j;
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < n_outputs; j++)
|
1999-09-12 03:51:28 +02:00
|
|
|
|
if (STACK_REG_P (recog_data.operand[j])
|
2001-07-10 12:38:10 +02:00
|
|
|
|
&& REGNO (recog_data.operand[j]) == (unsigned) i)
|
1992-01-19 05:23:39 +01:00
|
|
|
|
{
|
|
|
|
|
regstack->reg[++regstack->top] = i;
|
|
|
|
|
SET_HARD_REG_BIT (regstack->reg_set, i);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Now emit a pop insn for any REG_UNUSED output, or any REG_DEAD
|
|
|
|
|
input that the asm didn't implicitly pop. If the asm didn't
|
1992-03-21 05:53:32 +01:00
|
|
|
|
implicitly pop an input reg, that reg will still be live.
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
|
|
|
|
Note that we can't use find_regno_note here: the register numbers
|
|
|
|
|
in the death notes have already been substituted. */
|
|
|
|
|
|
1992-03-21 05:53:32 +01:00
|
|
|
|
for (i = 0; i < n_outputs; i++)
|
1999-09-12 03:51:28 +02:00
|
|
|
|
if (STACK_REG_P (recog_data.operand[i]))
|
1992-03-21 05:53:32 +01:00
|
|
|
|
{
|
|
|
|
|
int j;
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < n_notes; j++)
|
1999-09-12 03:51:28 +02:00
|
|
|
|
if (REGNO (recog_data.operand[i]) == REGNO (note_reg[j])
|
1992-03-21 05:53:32 +01:00
|
|
|
|
&& note_kind[j] == REG_UNUSED)
|
|
|
|
|
{
|
1999-09-12 03:51:28 +02:00
|
|
|
|
insn = emit_pop_insn (insn, regstack, recog_data.operand[i],
|
1999-10-27 03:25:13 +02:00
|
|
|
|
EMIT_AFTER);
|
1992-03-21 05:53:32 +01:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1998-12-04 13:55:59 +01:00
|
|
|
|
for (i = n_outputs; i < n_outputs + n_inputs; i++)
|
1999-09-12 03:51:28 +02:00
|
|
|
|
if (STACK_REG_P (recog_data.operand[i]))
|
1992-01-19 05:23:39 +01:00
|
|
|
|
{
|
|
|
|
|
int j;
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < n_notes; j++)
|
1999-09-12 03:51:28 +02:00
|
|
|
|
if (REGNO (recog_data.operand[i]) == REGNO (note_reg[j])
|
1992-03-21 05:53:32 +01:00
|
|
|
|
&& note_kind[j] == REG_DEAD
|
1998-12-04 13:55:59 +01:00
|
|
|
|
&& TEST_HARD_REG_BIT (regstack->reg_set,
|
1999-09-12 03:51:28 +02:00
|
|
|
|
REGNO (recog_data.operand[i])))
|
1992-01-19 05:23:39 +01:00
|
|
|
|
{
|
1999-09-12 03:51:28 +02:00
|
|
|
|
insn = emit_pop_insn (insn, regstack, recog_data.operand[i],
|
1999-10-27 03:25:13 +02:00
|
|
|
|
EMIT_AFTER);
|
1992-01-19 05:23:39 +01:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1991-12-26 11:05:42 +01:00
|
|
|
|
/* Substitute stack hard reg numbers for stack virtual registers in
|
|
|
|
|
INSN. Non-stack register numbers are not changed. REGSTACK is the
|
|
|
|
|
current stack content. Insns may be emitted as needed to arrange the
|
1998-04-27 21:24:06 +02:00
|
|
|
|
stack for the 387 based on the contents of the insn. */
|
1998-04-20 02:01:15 +02:00
|
|
|
|
|
1998-04-27 21:24:06 +02:00
|
|
|
|
static void
|
1991-12-26 11:05:42 +01:00
|
|
|
|
subst_stack_regs (insn, regstack)
|
|
|
|
|
rtx insn;
|
|
|
|
|
stack regstack;
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
rtx *note_link, note;
|
|
|
|
|
int i;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1995-04-26 01:06:57 +02:00
|
|
|
|
if (GET_CODE (insn) == CALL_INSN)
|
1999-09-02 06:20:21 +02:00
|
|
|
|
{
|
|
|
|
|
int top = regstack->top;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-09-02 06:20:21 +02:00
|
|
|
|
/* If there are any floating point parameters to be passed in
|
|
|
|
|
registers for this call, make sure they are in the right
|
|
|
|
|
order. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-09-02 06:20:21 +02:00
|
|
|
|
if (top >= 0)
|
|
|
|
|
{
|
|
|
|
|
straighten_stack (PREV_INSN (insn), regstack);
|
1995-04-26 01:06:57 +02:00
|
|
|
|
|
1999-09-02 06:20:21 +02:00
|
|
|
|
/* Now mark the arguments as dead after the call. */
|
1995-04-26 01:06:57 +02:00
|
|
|
|
|
1999-09-02 06:20:21 +02:00
|
|
|
|
while (regstack->top >= 0)
|
|
|
|
|
{
|
|
|
|
|
CLEAR_HARD_REG_BIT (regstack->reg_set, FIRST_STACK_REG + regstack->top);
|
|
|
|
|
regstack->top--;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
/* Do the actual substitution if any stack regs are mentioned.
|
|
|
|
|
Since we only record whether entire insn mentions stack regs, and
|
|
|
|
|
subst_stack_regs_pat only works for patterns that contain stack regs,
|
|
|
|
|
we must check each pattern in a parallel here. A call_value_pop could
|
1996-07-04 00:07:53 +02:00
|
|
|
|
fail otherwise. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-04-12 03:39:00 +02:00
|
|
|
|
if (stack_regs_mentioned (insn))
|
1991-12-26 11:05:42 +01:00
|
|
|
|
{
|
1998-12-04 13:55:59 +01:00
|
|
|
|
int n_operands = asm_noperands (PATTERN (insn));
|
1992-01-19 05:23:39 +01:00
|
|
|
|
if (n_operands >= 0)
|
|
|
|
|
{
|
|
|
|
|
/* This insn is an `asm' with operands. Decode the operands,
|
|
|
|
|
decide how many are inputs, and do register substitution.
|
1996-07-04 00:07:53 +02:00
|
|
|
|
Any REG_UNUSED notes will be handled by subst_asm_stack_regs. */
|
1992-01-19 05:23:39 +01:00
|
|
|
|
|
1998-12-04 13:55:59 +01:00
|
|
|
|
subst_asm_stack_regs (insn, regstack);
|
1998-04-27 21:24:06 +02:00
|
|
|
|
return;
|
1992-01-19 05:23:39 +01:00
|
|
|
|
}
|
|
|
|
|
|
1991-12-26 11:05:42 +01:00
|
|
|
|
if (GET_CODE (PATTERN (insn)) == PARALLEL)
|
1992-07-06 22:15:06 +02:00
|
|
|
|
for (i = 0; i < XVECLEN (PATTERN (insn), 0); i++)
|
1991-12-26 11:05:42 +01:00
|
|
|
|
{
|
|
|
|
|
if (stack_regs_mentioned_p (XVECEXP (PATTERN (insn), 0, i)))
|
1999-09-02 06:20:21 +02:00
|
|
|
|
subst_stack_regs_pat (insn, regstack,
|
|
|
|
|
XVECEXP (PATTERN (insn), 0, i));
|
1991-12-26 11:05:42 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
subst_stack_regs_pat (insn, regstack, PATTERN (insn));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* subst_stack_regs_pat may have deleted a no-op insn. If so, any
|
1996-07-04 00:07:53 +02:00
|
|
|
|
REG_UNUSED will already have been dealt with, so just return. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
2002-01-21 00:50:07 +01:00
|
|
|
|
if (GET_CODE (insn) == NOTE || INSN_DELETED_P (insn))
|
1998-04-27 21:24:06 +02:00
|
|
|
|
return;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
/* If there is a REG_UNUSED note on a stack register on this insn,
|
|
|
|
|
the indicated reg must be popped. The REG_UNUSED note is removed,
|
|
|
|
|
since the form of the newly emitted pop insn references the reg,
|
1996-07-04 00:07:53 +02:00
|
|
|
|
making it no longer `unset'. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
2002-01-15 14:38:03 +01:00
|
|
|
|
note_link = ®_NOTES (insn);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
for (note = *note_link; note; note = XEXP (note, 1))
|
|
|
|
|
if (REG_NOTE_KIND (note) == REG_UNUSED && STACK_REG_P (XEXP (note, 0)))
|
|
|
|
|
{
|
|
|
|
|
*note_link = XEXP (note, 1);
|
1999-10-27 03:25:13 +02:00
|
|
|
|
insn = emit_pop_insn (insn, regstack, XEXP (note, 0), EMIT_AFTER);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
note_link = &XEXP (note, 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Change the organization of the stack so that it fits a new basic
|
|
|
|
|
block. Some registers might have to be popped, but there can never be
|
|
|
|
|
a register live in the new block that is not now live.
|
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
Insert any needed insns before or after INSN, as indicated by
|
|
|
|
|
WHERE. OLD is the original stack layout, and NEW is the desired
|
|
|
|
|
form. OLD is updated to reflect the code emitted, ie, it will be
|
|
|
|
|
the same as NEW upon return.
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
This function will not preserve block_end[]. But that information
|
1996-07-04 00:07:53 +02:00
|
|
|
|
is no longer needed once this has executed. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
static void
|
1999-10-27 03:25:13 +02:00
|
|
|
|
change_stack (insn, old, new, where)
|
1991-12-26 11:05:42 +01:00
|
|
|
|
rtx insn;
|
|
|
|
|
stack old;
|
|
|
|
|
stack new;
|
1999-10-27 03:25:13 +02:00
|
|
|
|
enum emit_where where;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
{
|
|
|
|
|
int reg;
|
1999-10-27 03:25:13 +02:00
|
|
|
|
int update_end = 0;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* We will be inserting new insns "backwards". If we are to insert
|
|
|
|
|
after INSN, find the next insn, and insert before it. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
if (where == EMIT_AFTER)
|
|
|
|
|
{
|
|
|
|
|
if (current_block && current_block->end == insn)
|
|
|
|
|
update_end = 1;
|
|
|
|
|
insn = NEXT_INSN (insn);
|
|
|
|
|
}
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* Pop any registers that are not needed in the new block. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
for (reg = old->top; reg >= 0; reg--)
|
|
|
|
|
if (! TEST_HARD_REG_BIT (new->reg_set, old->reg[reg]))
|
1995-04-26 01:06:57 +02:00
|
|
|
|
emit_pop_insn (insn, old, FP_MODE_REG (old->reg[reg], DFmode),
|
1999-10-27 03:25:13 +02:00
|
|
|
|
EMIT_BEFORE);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
if (new->top == -2)
|
|
|
|
|
{
|
|
|
|
|
/* If the new block has never been processed, then it can inherit
|
1996-07-04 00:07:53 +02:00
|
|
|
|
the old stack order. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
new->top = old->top;
|
1999-10-27 03:25:13 +02:00
|
|
|
|
memcpy (new->reg, old->reg, sizeof (new->reg));
|
1991-12-26 11:05:42 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* This block has been entered before, and we must match the
|
1996-07-04 00:07:53 +02:00
|
|
|
|
previously selected stack order. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
/* By now, the only difference should be the order of the stack,
|
1996-07-04 00:07:53 +02:00
|
|
|
|
not their depth or liveliness. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
GO_IF_HARD_REG_EQUAL (old->reg_set, new->reg_set, win);
|
|
|
|
|
abort ();
|
|
|
|
|
win:
|
|
|
|
|
if (old->top != new->top)
|
|
|
|
|
abort ();
|
|
|
|
|
|
1999-08-07 07:57:14 +02:00
|
|
|
|
/* If the stack is not empty (new->top != -1), loop here emitting
|
2002-05-09 03:42:28 +02:00
|
|
|
|
swaps until the stack is correct.
|
1999-08-07 07:57:14 +02:00
|
|
|
|
|
|
|
|
|
The worst case number of swaps emitted is N + 2, where N is the
|
1991-12-26 11:05:42 +01:00
|
|
|
|
depth of the stack. In some cases, the reg at the top of
|
|
|
|
|
stack may be correct, but swapped anyway in order to fix
|
|
|
|
|
other regs. But since we never swap any other reg away from
|
1996-07-04 00:07:53 +02:00
|
|
|
|
its correct slot, this algorithm will converge. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-08-07 07:57:14 +02:00
|
|
|
|
if (new->top != -1)
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
/* Swap the reg at top of stack into the position it is
|
|
|
|
|
supposed to be in, until the correct top of stack appears. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-08-07 07:57:14 +02:00
|
|
|
|
while (old->reg[old->top] != new->reg[new->top])
|
|
|
|
|
{
|
|
|
|
|
for (reg = new->top; reg >= 0; reg--)
|
|
|
|
|
if (new->reg[reg] == old->reg[old->top])
|
|
|
|
|
break;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-08-07 07:57:14 +02:00
|
|
|
|
if (reg == -1)
|
|
|
|
|
abort ();
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-08-07 07:57:14 +02:00
|
|
|
|
emit_swap_insn (insn, old,
|
|
|
|
|
FP_MODE_REG (old->reg[reg], DFmode));
|
|
|
|
|
}
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-08-07 07:57:14 +02:00
|
|
|
|
/* See if any regs remain incorrect. If so, bring an
|
1991-12-26 11:05:42 +01:00
|
|
|
|
incorrect reg to the top of stack, and let the while loop
|
1996-07-04 00:07:53 +02:00
|
|
|
|
above fix it. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-08-07 07:57:14 +02:00
|
|
|
|
for (reg = new->top; reg >= 0; reg--)
|
|
|
|
|
if (new->reg[reg] != old->reg[reg])
|
|
|
|
|
{
|
|
|
|
|
emit_swap_insn (insn, old,
|
|
|
|
|
FP_MODE_REG (old->reg[reg], DFmode));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} while (reg >= 0);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* At this point there must be no differences. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
for (reg = old->top; reg >= 0; reg--)
|
|
|
|
|
if (old->reg[reg] != new->reg[reg])
|
|
|
|
|
abort ();
|
|
|
|
|
}
|
1999-10-27 03:25:13 +02:00
|
|
|
|
|
|
|
|
|
if (update_end)
|
|
|
|
|
current_block->end = PREV_INSN (insn);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
}
|
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* Print stack configuration. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
|
|
|
|
static void
|
1999-10-27 03:25:13 +02:00
|
|
|
|
print_stack (file, s)
|
|
|
|
|
FILE *file;
|
|
|
|
|
stack s;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
{
|
1999-10-27 03:25:13 +02:00
|
|
|
|
if (! file)
|
|
|
|
|
return;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
if (s->top == -2)
|
|
|
|
|
fprintf (file, "uninitialized\n");
|
|
|
|
|
else if (s->top == -1)
|
|
|
|
|
fprintf (file, "empty\n");
|
|
|
|
|
else
|
1999-09-02 06:20:21 +02:00
|
|
|
|
{
|
1999-10-27 03:25:13 +02:00
|
|
|
|
int i;
|
|
|
|
|
fputs ("[ ", file);
|
|
|
|
|
for (i = 0; i <= s->top; ++i)
|
|
|
|
|
fprintf (file, "%d ", s->reg[i]);
|
|
|
|
|
fputs ("]\n", file);
|
1999-09-02 06:20:21 +02:00
|
|
|
|
}
|
1999-10-27 03:25:13 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* This function was doing life analysis. We now let the regular live
|
2002-05-09 03:42:28 +02:00
|
|
|
|
code do it's job, so we only need to check some extra invariants
|
1999-10-27 03:25:13 +02:00
|
|
|
|
that reg-stack expects. Primary among these being that all registers
|
|
|
|
|
are initialized before use.
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
The function returns true when code was emitted to CFG edges and
|
|
|
|
|
commit_edge_insertions needs to be called. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
static int
|
|
|
|
|
convert_regs_entry ()
|
|
|
|
|
{
|
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 inserted = 0;
|
1999-10-27 03:25:13 +02:00
|
|
|
|
edge e;
|
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
|
|
|
|
basic_block block;
|
1991-12-26 11:05:42 +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_EACH_BB_REVERSE (block)
|
1991-12-26 11:05:42 +01:00
|
|
|
|
{
|
1999-10-27 03:25:13 +02:00
|
|
|
|
block_info bi = BLOCK_INFO (block);
|
|
|
|
|
int reg;
|
2002-05-09 03:42:28 +02:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* Set current register status at last instruction `uninitialized'. */
|
|
|
|
|
bi->stack_in.top = -2;
|
2002-05-09 03:42:28 +02:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* Copy live_at_end and live_at_start into temporaries. */
|
|
|
|
|
for (reg = FIRST_STACK_REG; reg <= LAST_STACK_REG; reg++)
|
1991-12-26 11:05:42 +01:00
|
|
|
|
{
|
1999-10-27 03:25:13 +02:00
|
|
|
|
if (REGNO_REG_SET_P (block->global_live_at_end, reg))
|
|
|
|
|
SET_HARD_REG_BIT (bi->out_reg_set, reg);
|
|
|
|
|
if (REGNO_REG_SET_P (block->global_live_at_start, reg))
|
|
|
|
|
SET_HARD_REG_BIT (bi->stack_in.reg_set, reg);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-05-09 03:42:28 +02:00
|
|
|
|
/* Load something into each stack register live at function entry.
|
1999-10-27 03:25:13 +02:00
|
|
|
|
Such live registers can be caused by uninitialized variables or
|
2002-05-09 03:42:28 +02:00
|
|
|
|
functions not returning values on all paths. In order to keep
|
1999-10-27 03:25:13 +02:00
|
|
|
|
the push/pop code happy, and to not scrog the register stack, we
|
2002-05-09 03:42:28 +02:00
|
|
|
|
must put something in these registers. Use a QNaN.
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
Note that we are insertting converted code here. This code is
|
|
|
|
|
never seen by the convert_regs pass. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
for (e = ENTRY_BLOCK_PTR->succ; e ; e = e->succ_next)
|
|
|
|
|
{
|
|
|
|
|
basic_block block = e->dest;
|
|
|
|
|
block_info bi = BLOCK_INFO (block);
|
|
|
|
|
int reg, top = -1;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
for (reg = LAST_STACK_REG; reg >= FIRST_STACK_REG; --reg)
|
|
|
|
|
if (TEST_HARD_REG_BIT (bi->stack_in.reg_set, reg))
|
|
|
|
|
{
|
|
|
|
|
rtx init;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
bi->stack_in.reg[++top] = reg;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
init = gen_rtx_SET (VOIDmode,
|
|
|
|
|
FP_MODE_REG (FIRST_STACK_REG, SFmode),
|
|
|
|
|
nan);
|
|
|
|
|
insert_insn_on_edge (init, e);
|
|
|
|
|
inserted = 1;
|
|
|
|
|
}
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
bi->stack_in.top = top;
|
|
|
|
|
}
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
return inserted;
|
|
|
|
|
}
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* Construct the desired stack for function exit. This will either
|
|
|
|
|
be `empty', or the function return value at top-of-stack. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
static void
|
|
|
|
|
convert_regs_exit ()
|
|
|
|
|
{
|
|
|
|
|
int value_reg_low, value_reg_high;
|
|
|
|
|
stack output_stack;
|
|
|
|
|
rtx retvalue;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
retvalue = stack_result (current_function_decl);
|
|
|
|
|
value_reg_low = value_reg_high = -1;
|
|
|
|
|
if (retvalue)
|
|
|
|
|
{
|
|
|
|
|
value_reg_low = REGNO (retvalue);
|
|
|
|
|
value_reg_high = value_reg_low
|
|
|
|
|
+ HARD_REGNO_NREGS (value_reg_low, GET_MODE (retvalue)) - 1;
|
|
|
|
|
}
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
output_stack = &BLOCK_INFO (EXIT_BLOCK_PTR)->stack_in;
|
|
|
|
|
if (value_reg_low == -1)
|
|
|
|
|
output_stack->top = -1;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int reg;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
output_stack->top = value_reg_high - value_reg_low;
|
|
|
|
|
for (reg = value_reg_low; reg <= value_reg_high; ++reg)
|
|
|
|
|
{
|
2002-06-23 07:30:14 +02:00
|
|
|
|
output_stack->reg[value_reg_high - reg] = reg;
|
1999-10-27 03:25:13 +02:00
|
|
|
|
SET_HARD_REG_BIT (output_stack->reg_set, reg);
|
|
|
|
|
}
|
|
|
|
|
}
|
1991-12-26 11:05:42 +01:00
|
|
|
|
}
|
|
|
|
|
|
2001-07-30 22:30:23 +02:00
|
|
|
|
/* Adjust the stack of this block on exit to match the stack of the
|
|
|
|
|
target block, or copy stack info into the stack of the successor
|
|
|
|
|
of the successor hasn't been processed yet. */
|
|
|
|
|
static bool
|
|
|
|
|
compensate_edge (e, file)
|
|
|
|
|
edge e;
|
|
|
|
|
FILE *file;
|
|
|
|
|
{
|
|
|
|
|
basic_block block = e->src, target = e->dest;
|
|
|
|
|
block_info bi = BLOCK_INFO (block);
|
|
|
|
|
struct stack_def regstack, tmpstack;
|
|
|
|
|
stack target_stack = &BLOCK_INFO (target)->stack_in;
|
|
|
|
|
int reg;
|
|
|
|
|
|
|
|
|
|
current_block = block;
|
|
|
|
|
regstack = bi->stack_out;
|
|
|
|
|
if (file)
|
2002-05-17 04:31:56 +02:00
|
|
|
|
fprintf (file, "Edge %d->%d: ", block->index, target->index);
|
2001-07-30 22:30:23 +02:00
|
|
|
|
|
|
|
|
|
if (target_stack->top == -2)
|
|
|
|
|
{
|
|
|
|
|
/* The target block hasn't had a stack order selected.
|
|
|
|
|
We need merely ensure that no pops are needed. */
|
|
|
|
|
for (reg = regstack.top; reg >= 0; --reg)
|
|
|
|
|
if (!TEST_HARD_REG_BIT (target_stack->reg_set, regstack.reg[reg]))
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if (reg == -1)
|
|
|
|
|
{
|
|
|
|
|
if (file)
|
|
|
|
|
fprintf (file, "new block; copying stack position\n");
|
|
|
|
|
|
|
|
|
|
/* change_stack kills values in regstack. */
|
|
|
|
|
tmpstack = regstack;
|
|
|
|
|
|
|
|
|
|
change_stack (block->end, &tmpstack, target_stack, EMIT_AFTER);
|
2002-05-09 03:42:28 +02:00
|
|
|
|
return false;
|
2001-07-30 22:30:23 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (file)
|
|
|
|
|
fprintf (file, "new block; pops needed\n");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (target_stack->top == regstack.top)
|
|
|
|
|
{
|
|
|
|
|
for (reg = target_stack->top; reg >= 0; --reg)
|
|
|
|
|
if (target_stack->reg[reg] != regstack.reg[reg])
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if (reg == -1)
|
|
|
|
|
{
|
|
|
|
|
if (file)
|
|
|
|
|
fprintf (file, "no changes needed\n");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (file)
|
|
|
|
|
{
|
|
|
|
|
fprintf (file, "correcting stack to ");
|
|
|
|
|
print_stack (file, target_stack);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Care for non-call EH edges specially. The normal return path have
|
|
|
|
|
values in registers. These will be popped en masse by the unwind
|
|
|
|
|
library. */
|
|
|
|
|
if ((e->flags & (EDGE_EH | EDGE_ABNORMAL_CALL)) == EDGE_EH)
|
|
|
|
|
target_stack->top = -1;
|
|
|
|
|
|
|
|
|
|
/* Other calls may appear to have values live in st(0), but the
|
|
|
|
|
abnormal return path will not have actually loaded the values. */
|
|
|
|
|
else if (e->flags & EDGE_ABNORMAL_CALL)
|
|
|
|
|
{
|
|
|
|
|
/* Assert that the lifetimes are as we expect -- one value
|
|
|
|
|
live at st(0) on the end of the source block, and no
|
|
|
|
|
values live at the beginning of the destination block. */
|
|
|
|
|
HARD_REG_SET tmp;
|
|
|
|
|
|
|
|
|
|
CLEAR_HARD_REG_SET (tmp);
|
|
|
|
|
GO_IF_HARD_REG_EQUAL (target_stack->reg_set, tmp, eh1);
|
|
|
|
|
abort ();
|
|
|
|
|
eh1:
|
|
|
|
|
|
|
|
|
|
SET_HARD_REG_BIT (tmp, FIRST_STACK_REG);
|
|
|
|
|
GO_IF_HARD_REG_EQUAL (regstack.reg_set, tmp, eh2);
|
|
|
|
|
abort ();
|
|
|
|
|
eh2:
|
|
|
|
|
|
|
|
|
|
target_stack->top = -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* It is better to output directly to the end of the block
|
|
|
|
|
instead of to the edge, because emit_swap can do minimal
|
|
|
|
|
insn scheduling. We can do this when there is only one
|
|
|
|
|
edge out, and it is not abnormal. */
|
|
|
|
|
else if (block->succ->succ_next == NULL && !(e->flags & EDGE_ABNORMAL))
|
|
|
|
|
{
|
|
|
|
|
/* change_stack kills values in regstack. */
|
|
|
|
|
tmpstack = regstack;
|
|
|
|
|
|
|
|
|
|
change_stack (block->end, &tmpstack, target_stack,
|
|
|
|
|
(GET_CODE (block->end) == JUMP_INSN
|
|
|
|
|
? EMIT_BEFORE : EMIT_AFTER));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
rtx seq, after;
|
|
|
|
|
|
|
|
|
|
/* We don't support abnormal edges. Global takes care to
|
|
|
|
|
avoid any live register across them, so we should never
|
|
|
|
|
have to insert instructions on such edges. */
|
|
|
|
|
if (e->flags & EDGE_ABNORMAL)
|
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
|
|
current_block = NULL;
|
|
|
|
|
start_sequence ();
|
|
|
|
|
|
Delete SEQUENCE rtl usage outside of reorg and ssa passes.
2002-06-05 David S. Miller <davem@redhat.com>
Delete SEQUENCE rtl usage outside of reorg and ssa passes.
* rtl.h (gen_sequence, emit_insns, emit_insns_before,
emit_insns_before_scope, emit_insns_after,
emit_insns_after_scope): Delete declaration.
* ada/misc.c (insert_code_for): Use emit_insn* instead of
emit_insns_foo.
* config/alpha/alpha.c (alpha_set_memflags_1): Abort on SEQUENCE.
(alpha_set_memflags): Fix comment.
(set_frame_related_p): Use get_insns instead of gen_sequence.
* config/alpha/alpha.md (setjmp receiver splitter): Avoid
emitting no insns.
* config/arm/arm.c (arm_finalize_pic): Use get_insns instead of
gen_sequence.
(arm_gen_load_multiple, arm_gen_store_multiple): Likewise.
* config/fr30/fr30.c (fr30_move_double): Likewise.
* config/i386/i386.c (ix86_expand_int_movcc, ix86_expand_movstr):
Likewise.
* config/ia64/ia64.c (spill_restore_mem): Likewise.
* config/ia64/ia64.md (conditional move spliiter): Avoid emitting
no insns.
* config/m32r/m32r.c (gen_split_move_double): Use get_insns
instead of gen_sequence.
* config/mips/mips.c (embedded_pic_fnaddr_reg): Likewise.
(mips_expand_prologue, mips16_gp_pseudo_reg): Likewise.
* config/sh/sh.c (sh_need_epilogue): Likewise.
* config/sparc/sparc.md (current_function_calls_alloca, flat): New
attributes.
(setjmp pattern and split): Use them to avoid splitter which emits
no RTL.
* genattrtab.c (main): Emit include of function.h
* config/stormy16/stormy16.c (xstormy16_split_cbranch): Use
get_insns instead of gen_sequence.
* config/cris/cris.c (cris_split_movdx): Likewise.
* emit-rtl.c (emit_insns*): Kill.
(try_split): Expect insn list instead of SEQUENCE.
(make_jump_insn_raw, make_call_insn_raw): Fix comments.
(emit_*insn*): Reimplement to work with INSN lists and PATTERNs.
Make them abort if a SEQUENCE is given and RTL checking is
enabled.
(emit_*_scope): Don't forget to set scope on final insn.
(gen_sequence): Move from here...
* ssa.c (gen_sequence): To here as private function.
* builtins.c (expand_builtin_apply_args): Use emit_insn_foo, fix
comments.
(expand_builtin_return, expand_builtin_mathfn): Likewise.
(expand_builtin_strlen): Use get_insns instead of gen_sequence.
(expand_builtin_saveregs): Use emit_insn_foo, fix comments.
(expand_builtin_expect_jump): Use get_insns and fix comments.
* calls.c (try_to_integrate): Use emit_insn_foo.
(expand_call, emit_library_call_value_1): Likewise.
* expr.c (emit_queue): Handle insn lists instead of SEQUENCE.
(emit_move_insn_1): Use get_insns instead of gen_sequence.
(expand_expr): Use emit_insn_foo.
* cfgrtl.c (commit_one_edge_insertion): Use emit_insn_foo.
* except.c (build_post_landing_pads): Likewise.
* flow.c (attempt_auto_inc): Likewise.
* stmt.c (expand_fixup, fixup_gotos, expand_nl_handler_label,
expand_nl_goto_receivers, expand_decl_cleanup): Likewise.
* function.c (fixup_var_refs_insn): Use get_insns instead of
gen_sequence.
(fixup_var_refs_1): Likewise and expect insn list from gen_foo.
(fixup_memory_subreg): Use get_insns instead of gen_sequence.
(fixup_stack_1, purge_addressof_1, expand_main_function,
get_arg_pointer_save_area): Likewise.
(optimize_bit_field, instantiate_virtual_regs_1, assign_parms,
expand_function_end): Use emit_insn_foo.
(record_insns, keep_stack_depressed): Work with insn list instead
of SEQUENCE, fix comments.
* ifcvt.c (noce_emit_store_flag, noce_try_store_flag,
noce_try_store_flag_constants, noce_try_store_flag_inc,
noce_try_store_flag_mask, noce_emit_cmove, noce_try_cmove_arith,
noce_try_minmax, noce_try_abs): Use emit_insn_foo.
(noce_process_if_block): Use get_insns instead of gen_sequence.
* optabs.c (add_equal_note): Work with insn list, fix comments.
(expand_binop): Expect insn list from GEN_FCN(), use emit_insn_foo.
(expand_unop, expand_complex_abs, expand_unop_insn,
expand_no_conflict_block): Likewise.
(gen_move_insn): Use get_insns instead of gen_sequence.
(gen_cond_trap): Likewise.
* integrate.c (copy_rtx_and_substitute): Likewise.
(emit_initial_value_sets): Use emit_insn_foo.
* reload1.c (emit_output_reload_insns, emit_reload_insns): Likewise.
(fixup_abnormal_edges): Avoid losing REG_NOTES more intelligently
now that RTL generators give insn lists.
* sibcall.c (replace_call_placeholder): Use emit_insn_foo.
* doloop.c (doloop_modify, doloop_modify_runtime): Use get_insns
instead of gen_sequence.
(doloop_optimize): Work with insn lists instead of SEQUENCE rtl.
* explow.c (emit_stack_save, emit_stack_restore): Use get_insns
instead of gen_sequence.
* loop.c (move_movables, emit_prefetch_instructions,
gen_add_mult, check_dbra_loop, gen_load_of_final_value):
Likewise.
(loop_regs_update): Work with insn list instead of SEQUENCE rtl.
(product_cheap_p): Likewise, and add commentary about RTL wastage
here.
* lcm.c (optimize_mode_switching): Use get_insns instead of
gen_sequence.
* profile.c (gen_edge_profiler): Likewise.
* regmove.c (copy_src_to_dest): Likewise.
* reg-stack.c (compensate_edge): Likewise and fix comment.
* gcse.c (process_insert_insn): Likewise.
(insert_insn_end_bb): Work with insn list instead of SEQUENCE rtl.
* jump.c (delete_prior_computation): Update comment.
* genemit.c (gen_expand, gen_split, main): Use get_insns instead
of gen_sequence, update comments to match.
* recog.c (peephole2_optimize): Work with insn lists instead of
SEQUENCE rtl.
* sched-vis.c (print_pattern): Abort on SEQUENCE.
* unroll.c (unroll_loop, find_splittable_givs, final_giv_value):
Use get_insns instead of gen_sequence.
(copy_loop_body): Likewise and don't emit dummy NOTE.
* genrecog.c: Don't mention SEQUENCE rtl in comments.
* combine.c (try_combine): Expect insn lists from split generator.
* reorg.c (relax_delay_slots): Emit SEQUENCE into insn list by
hand.
From-SVN: r54497
2002-06-11 14:22:48 +02:00
|
|
|
|
/* ??? change_stack needs some point to emit insns after. */
|
2001-07-30 22:30:23 +02:00
|
|
|
|
after = emit_note (NULL, NOTE_INSN_DELETED);
|
|
|
|
|
|
|
|
|
|
tmpstack = regstack;
|
|
|
|
|
change_stack (after, &tmpstack, target_stack, EMIT_BEFORE);
|
|
|
|
|
|
Delete SEQUENCE rtl usage outside of reorg and ssa passes.
2002-06-05 David S. Miller <davem@redhat.com>
Delete SEQUENCE rtl usage outside of reorg and ssa passes.
* rtl.h (gen_sequence, emit_insns, emit_insns_before,
emit_insns_before_scope, emit_insns_after,
emit_insns_after_scope): Delete declaration.
* ada/misc.c (insert_code_for): Use emit_insn* instead of
emit_insns_foo.
* config/alpha/alpha.c (alpha_set_memflags_1): Abort on SEQUENCE.
(alpha_set_memflags): Fix comment.
(set_frame_related_p): Use get_insns instead of gen_sequence.
* config/alpha/alpha.md (setjmp receiver splitter): Avoid
emitting no insns.
* config/arm/arm.c (arm_finalize_pic): Use get_insns instead of
gen_sequence.
(arm_gen_load_multiple, arm_gen_store_multiple): Likewise.
* config/fr30/fr30.c (fr30_move_double): Likewise.
* config/i386/i386.c (ix86_expand_int_movcc, ix86_expand_movstr):
Likewise.
* config/ia64/ia64.c (spill_restore_mem): Likewise.
* config/ia64/ia64.md (conditional move spliiter): Avoid emitting
no insns.
* config/m32r/m32r.c (gen_split_move_double): Use get_insns
instead of gen_sequence.
* config/mips/mips.c (embedded_pic_fnaddr_reg): Likewise.
(mips_expand_prologue, mips16_gp_pseudo_reg): Likewise.
* config/sh/sh.c (sh_need_epilogue): Likewise.
* config/sparc/sparc.md (current_function_calls_alloca, flat): New
attributes.
(setjmp pattern and split): Use them to avoid splitter which emits
no RTL.
* genattrtab.c (main): Emit include of function.h
* config/stormy16/stormy16.c (xstormy16_split_cbranch): Use
get_insns instead of gen_sequence.
* config/cris/cris.c (cris_split_movdx): Likewise.
* emit-rtl.c (emit_insns*): Kill.
(try_split): Expect insn list instead of SEQUENCE.
(make_jump_insn_raw, make_call_insn_raw): Fix comments.
(emit_*insn*): Reimplement to work with INSN lists and PATTERNs.
Make them abort if a SEQUENCE is given and RTL checking is
enabled.
(emit_*_scope): Don't forget to set scope on final insn.
(gen_sequence): Move from here...
* ssa.c (gen_sequence): To here as private function.
* builtins.c (expand_builtin_apply_args): Use emit_insn_foo, fix
comments.
(expand_builtin_return, expand_builtin_mathfn): Likewise.
(expand_builtin_strlen): Use get_insns instead of gen_sequence.
(expand_builtin_saveregs): Use emit_insn_foo, fix comments.
(expand_builtin_expect_jump): Use get_insns and fix comments.
* calls.c (try_to_integrate): Use emit_insn_foo.
(expand_call, emit_library_call_value_1): Likewise.
* expr.c (emit_queue): Handle insn lists instead of SEQUENCE.
(emit_move_insn_1): Use get_insns instead of gen_sequence.
(expand_expr): Use emit_insn_foo.
* cfgrtl.c (commit_one_edge_insertion): Use emit_insn_foo.
* except.c (build_post_landing_pads): Likewise.
* flow.c (attempt_auto_inc): Likewise.
* stmt.c (expand_fixup, fixup_gotos, expand_nl_handler_label,
expand_nl_goto_receivers, expand_decl_cleanup): Likewise.
* function.c (fixup_var_refs_insn): Use get_insns instead of
gen_sequence.
(fixup_var_refs_1): Likewise and expect insn list from gen_foo.
(fixup_memory_subreg): Use get_insns instead of gen_sequence.
(fixup_stack_1, purge_addressof_1, expand_main_function,
get_arg_pointer_save_area): Likewise.
(optimize_bit_field, instantiate_virtual_regs_1, assign_parms,
expand_function_end): Use emit_insn_foo.
(record_insns, keep_stack_depressed): Work with insn list instead
of SEQUENCE, fix comments.
* ifcvt.c (noce_emit_store_flag, noce_try_store_flag,
noce_try_store_flag_constants, noce_try_store_flag_inc,
noce_try_store_flag_mask, noce_emit_cmove, noce_try_cmove_arith,
noce_try_minmax, noce_try_abs): Use emit_insn_foo.
(noce_process_if_block): Use get_insns instead of gen_sequence.
* optabs.c (add_equal_note): Work with insn list, fix comments.
(expand_binop): Expect insn list from GEN_FCN(), use emit_insn_foo.
(expand_unop, expand_complex_abs, expand_unop_insn,
expand_no_conflict_block): Likewise.
(gen_move_insn): Use get_insns instead of gen_sequence.
(gen_cond_trap): Likewise.
* integrate.c (copy_rtx_and_substitute): Likewise.
(emit_initial_value_sets): Use emit_insn_foo.
* reload1.c (emit_output_reload_insns, emit_reload_insns): Likewise.
(fixup_abnormal_edges): Avoid losing REG_NOTES more intelligently
now that RTL generators give insn lists.
* sibcall.c (replace_call_placeholder): Use emit_insn_foo.
* doloop.c (doloop_modify, doloop_modify_runtime): Use get_insns
instead of gen_sequence.
(doloop_optimize): Work with insn lists instead of SEQUENCE rtl.
* explow.c (emit_stack_save, emit_stack_restore): Use get_insns
instead of gen_sequence.
* loop.c (move_movables, emit_prefetch_instructions,
gen_add_mult, check_dbra_loop, gen_load_of_final_value):
Likewise.
(loop_regs_update): Work with insn list instead of SEQUENCE rtl.
(product_cheap_p): Likewise, and add commentary about RTL wastage
here.
* lcm.c (optimize_mode_switching): Use get_insns instead of
gen_sequence.
* profile.c (gen_edge_profiler): Likewise.
* regmove.c (copy_src_to_dest): Likewise.
* reg-stack.c (compensate_edge): Likewise and fix comment.
* gcse.c (process_insert_insn): Likewise.
(insert_insn_end_bb): Work with insn list instead of SEQUENCE rtl.
* jump.c (delete_prior_computation): Update comment.
* genemit.c (gen_expand, gen_split, main): Use get_insns instead
of gen_sequence, update comments to match.
* recog.c (peephole2_optimize): Work with insn lists instead of
SEQUENCE rtl.
* sched-vis.c (print_pattern): Abort on SEQUENCE.
* unroll.c (unroll_loop, find_splittable_givs, final_giv_value):
Use get_insns instead of gen_sequence.
(copy_loop_body): Likewise and don't emit dummy NOTE.
* genrecog.c: Don't mention SEQUENCE rtl in comments.
* combine.c (try_combine): Expect insn lists from split generator.
* reorg.c (relax_delay_slots): Emit SEQUENCE into insn list by
hand.
From-SVN: r54497
2002-06-11 14:22:48 +02:00
|
|
|
|
seq = get_insns ();
|
2001-07-30 22:30:23 +02:00
|
|
|
|
end_sequence ();
|
|
|
|
|
|
|
|
|
|
insert_insn_on_edge (seq, e);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* Convert stack register references in one block. */
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
convert_regs_1 (file, block)
|
|
|
|
|
FILE *file;
|
|
|
|
|
basic_block block;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
{
|
2001-07-30 22:30:23 +02:00
|
|
|
|
struct stack_def regstack;
|
1999-10-27 03:25:13 +02:00
|
|
|
|
block_info bi = BLOCK_INFO (block);
|
|
|
|
|
int inserted, reg;
|
|
|
|
|
rtx insn, next;
|
2001-07-30 22:30:23 +02:00
|
|
|
|
edge e, beste = NULL;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
2001-07-30 22:30:23 +02:00
|
|
|
|
inserted = 0;
|
|
|
|
|
|
|
|
|
|
/* Find the edge we will copy stack from. It should be the most frequent
|
|
|
|
|
one as it will get cheapest after compensation code is generated,
|
ChangeLog.0, [...]: Fix spelling errors.
* ChangeLog.0, ChangeLog.1, ChangeLog.2, ChangeLog.3, ChangeLog.4,
ChangeLog.5, ChangeLog, FSFChangeLog.10, FSFChangeLog.11,
c-common.c, c-common.h, c-parse.in, c-typeck.c, cfg.c, config.gcc,
configure, configure.in, except.c, except.h, flow.c, function.c,
gcc.c, gcse.c, genrecog.c, libgcc2.c, loop.c, loop.h, params.def,
predict.def, predict.h, reg-stack.c, regmove.c, sched-deps.c,
sched-int.h, sibcall.c, ssa.c, stringpool.c, toplev.c, tree.c,
unroll.c: Fix spelling errors.
From-SVN: r46595
2001-10-28 21:09:17 +01:00
|
|
|
|
if multiple such exists, take one with largest count, prefer critical
|
2001-07-30 22:30:23 +02:00
|
|
|
|
one (as splitting critical edges is more expensive), or one with lowest
|
|
|
|
|
index, to avoid random changes with different orders of the edges. */
|
|
|
|
|
for (e = block->pred; e ; e = e->pred_next)
|
|
|
|
|
{
|
|
|
|
|
if (e->flags & EDGE_DFS_BACK)
|
|
|
|
|
;
|
|
|
|
|
else if (! beste)
|
|
|
|
|
beste = e;
|
|
|
|
|
else if (EDGE_FREQUENCY (beste) < EDGE_FREQUENCY (e))
|
|
|
|
|
beste = e;
|
2001-07-31 15:43:22 +02:00
|
|
|
|
else if (EDGE_FREQUENCY (beste) > EDGE_FREQUENCY (e))
|
|
|
|
|
;
|
2001-07-30 22:30:23 +02:00
|
|
|
|
else if (beste->count < e->count)
|
|
|
|
|
beste = e;
|
|
|
|
|
else if (beste->count > e->count)
|
|
|
|
|
;
|
2001-09-11 18:58:57 +02:00
|
|
|
|
else if ((EDGE_CRITICAL_P (e) != 0)
|
|
|
|
|
!= (EDGE_CRITICAL_P (beste) != 0))
|
2001-07-30 22:30:23 +02:00
|
|
|
|
{
|
2001-09-11 18:58:57 +02:00
|
|
|
|
if (EDGE_CRITICAL_P (e))
|
2001-07-30 22:30:23 +02:00
|
|
|
|
beste = e;
|
|
|
|
|
}
|
2002-05-17 04:31:56 +02:00
|
|
|
|
else if (e->src->index < beste->src->index)
|
2001-07-30 22:30:23 +02:00
|
|
|
|
beste = e;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Entry block does have stack already initialized. */
|
|
|
|
|
if (bi->stack_in.top == -2)
|
|
|
|
|
inserted |= compensate_edge (beste, file);
|
|
|
|
|
else
|
|
|
|
|
beste = NULL;
|
2002-05-09 03:42:28 +02:00
|
|
|
|
|
2001-07-30 22:30:23 +02:00
|
|
|
|
current_block = block;
|
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
if (file)
|
1991-12-26 11:05:42 +01:00
|
|
|
|
{
|
2002-05-17 04:31:56 +02:00
|
|
|
|
fprintf (file, "\nBasic block %d\nInput stack: ", block->index);
|
1999-10-27 03:25:13 +02:00
|
|
|
|
print_stack (file, &bi->stack_in);
|
|
|
|
|
}
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* Process all insns in this block. Keep track of NEXT so that we
|
|
|
|
|
don't process insns emitted while substituting in INSN. */
|
|
|
|
|
next = block->head;
|
|
|
|
|
regstack = bi->stack_in;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
insn = next;
|
|
|
|
|
next = NEXT_INSN (insn);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* Ensure we have not missed a block boundary. */
|
|
|
|
|
if (next == NULL)
|
|
|
|
|
abort ();
|
|
|
|
|
if (insn == block->end)
|
|
|
|
|
next = NULL;
|
|
|
|
|
|
|
|
|
|
/* Don't bother processing unless there is a stack reg
|
|
|
|
|
mentioned or if it's a CALL_INSN. */
|
|
|
|
|
if (stack_regs_mentioned (insn)
|
|
|
|
|
|| GET_CODE (insn) == CALL_INSN)
|
|
|
|
|
{
|
|
|
|
|
if (file)
|
|
|
|
|
{
|
|
|
|
|
fprintf (file, " insn %d input stack: ",
|
|
|
|
|
INSN_UID (insn));
|
|
|
|
|
print_stack (file, ®stack);
|
|
|
|
|
}
|
|
|
|
|
subst_stack_regs (insn, ®stack);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
}
|
1999-10-27 03:25:13 +02:00
|
|
|
|
}
|
|
|
|
|
while (next);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
if (file)
|
|
|
|
|
{
|
|
|
|
|
fprintf (file, "Expected live registers [");
|
|
|
|
|
for (reg = FIRST_STACK_REG; reg <= LAST_STACK_REG; ++reg)
|
|
|
|
|
if (TEST_HARD_REG_BIT (bi->out_reg_set, reg))
|
|
|
|
|
fprintf (file, " %d", reg);
|
|
|
|
|
fprintf (file, " ]\nOutput stack: ");
|
|
|
|
|
print_stack (file, ®stack);
|
|
|
|
|
}
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
insn = block->end;
|
|
|
|
|
if (GET_CODE (insn) == JUMP_INSN)
|
|
|
|
|
insn = PREV_INSN (insn);
|
|
|
|
|
|
|
|
|
|
/* If the function is declared to return a value, but it returns one
|
|
|
|
|
in only some cases, some registers might come live here. Emit
|
|
|
|
|
necessary moves for them. */
|
|
|
|
|
|
|
|
|
|
for (reg = FIRST_STACK_REG; reg <= LAST_STACK_REG; ++reg)
|
|
|
|
|
{
|
|
|
|
|
if (TEST_HARD_REG_BIT (bi->out_reg_set, reg)
|
|
|
|
|
&& ! TEST_HARD_REG_BIT (regstack.reg_set, reg))
|
1991-12-26 11:05:42 +01:00
|
|
|
|
{
|
1999-10-27 03:25:13 +02:00
|
|
|
|
rtx set;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
if (file)
|
|
|
|
|
{
|
|
|
|
|
fprintf (file, "Emitting insn initializing reg %d\n",
|
|
|
|
|
reg);
|
|
|
|
|
}
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
set = gen_rtx_SET (VOIDmode, FP_MODE_REG (reg, SFmode),
|
|
|
|
|
nan);
|
2001-09-16 22:21:30 +02:00
|
|
|
|
insn = emit_insn_after (set, insn);
|
1999-10-27 03:25:13 +02:00
|
|
|
|
subst_stack_regs (insn, ®stack);
|
|
|
|
|
}
|
|
|
|
|
}
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* Something failed if the stack lives don't match. */
|
|
|
|
|
GO_IF_HARD_REG_EQUAL (regstack.reg_set, bi->out_reg_set, win);
|
|
|
|
|
abort ();
|
|
|
|
|
win:
|
2001-07-30 22:30:23 +02:00
|
|
|
|
bi->stack_out = regstack;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
2001-07-30 22:30:23 +02:00
|
|
|
|
/* Compensate the back edges, as those wasn't visited yet. */
|
1999-10-27 03:25:13 +02:00
|
|
|
|
for (e = block->succ; e ; e = e->succ_next)
|
|
|
|
|
{
|
2001-07-30 22:30:23 +02:00
|
|
|
|
if (e->flags & EDGE_DFS_BACK
|
|
|
|
|
|| (e->dest == EXIT_BLOCK_PTR))
|
1999-10-27 03:25:13 +02:00
|
|
|
|
{
|
2001-07-30 22:30:23 +02:00
|
|
|
|
if (!BLOCK_INFO (e->dest)->done
|
|
|
|
|
&& e->dest != block)
|
|
|
|
|
abort ();
|
2002-05-09 03:42:28 +02:00
|
|
|
|
inserted |= compensate_edge (e, file);
|
1999-09-02 06:20:21 +02:00
|
|
|
|
}
|
2001-07-30 22:30:23 +02:00
|
|
|
|
}
|
|
|
|
|
for (e = block->pred; e ; e = e->pred_next)
|
|
|
|
|
{
|
|
|
|
|
if (e != beste && !(e->flags & EDGE_DFS_BACK)
|
|
|
|
|
&& e->src != ENTRY_BLOCK_PTR)
|
1999-10-27 03:25:13 +02:00
|
|
|
|
{
|
2001-07-30 22:30:23 +02:00
|
|
|
|
if (!BLOCK_INFO (e->src)->done)
|
1999-10-27 03:25:13 +02:00
|
|
|
|
abort ();
|
2002-05-09 03:42:28 +02:00
|
|
|
|
inserted |= compensate_edge (e, file);
|
1999-10-27 03:25:13 +02:00
|
|
|
|
}
|
1999-09-02 06:20:21 +02:00
|
|
|
|
}
|
1999-10-27 03:25:13 +02:00
|
|
|
|
|
|
|
|
|
return inserted;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
}
|
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* Convert registers in all blocks reachable from BLOCK. */
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
convert_regs_2 (file, block)
|
1991-12-26 11:05:42 +01:00
|
|
|
|
FILE *file;
|
1999-10-27 03:25:13 +02:00
|
|
|
|
basic_block block;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
{
|
1999-10-27 03:25:13 +02:00
|
|
|
|
basic_block *stack, *sp;
|
|
|
|
|
int inserted;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
2002-05-17 04:31:56 +02:00
|
|
|
|
stack = (basic_block *) xmalloc (sizeof (*stack) * n_basic_blocks);
|
1999-10-27 03:25:13 +02:00
|
|
|
|
sp = stack;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
*sp++ = block;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
inserted = 0;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
edge e;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
block = *--sp;
|
|
|
|
|
inserted |= convert_regs_1 (file, block);
|
2001-07-30 22:30:23 +02:00
|
|
|
|
BLOCK_INFO (block)->done = 1;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
for (e = block->succ; e ; e = e->succ_next)
|
2001-07-30 22:30:23 +02:00
|
|
|
|
if (! (e->flags & EDGE_DFS_BACK))
|
1999-10-27 03:25:13 +02:00
|
|
|
|
{
|
2001-11-23 02:37:07 +01:00
|
|
|
|
BLOCK_INFO (e->dest)->predecessors--;
|
|
|
|
|
if (!BLOCK_INFO (e->dest)->predecessors)
|
2001-07-30 22:30:23 +02:00
|
|
|
|
*sp++ = e->dest;
|
1999-10-27 03:25:13 +02:00
|
|
|
|
}
|
1991-12-26 11:05:42 +01:00
|
|
|
|
}
|
1999-10-27 03:25:13 +02:00
|
|
|
|
while (sp != stack);
|
|
|
|
|
|
|
|
|
|
return inserted;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
}
|
1996-05-19 18:24:50 +02:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* Traverse all basic blocks in a function, converting the register
|
|
|
|
|
references in each insn from the "flat" register file that gcc uses,
|
|
|
|
|
to the stack-like registers the 387 uses. */
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
convert_regs (file)
|
1991-12-26 11:05:42 +01:00
|
|
|
|
FILE *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 inserted;
|
|
|
|
|
basic_block b;
|
1999-10-27 03:25:13 +02:00
|
|
|
|
edge e;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* Initialize uninitialized registers on function entry. */
|
|
|
|
|
inserted = convert_regs_entry ();
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* Construct the desired stack for function exit. */
|
|
|
|
|
convert_regs_exit ();
|
|
|
|
|
BLOCK_INFO (EXIT_BLOCK_PTR)->done = 1;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* ??? Future: process inner loops first, and give them arbitrary
|
|
|
|
|
initial stacks which emit_swap_insn can modify. This ought to
|
|
|
|
|
prevent double fxch that aften appears at the head of a loop. */
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* Process all blocks reachable from all entry points. */
|
|
|
|
|
for (e = ENTRY_BLOCK_PTR->succ; e ; e = e->succ_next)
|
|
|
|
|
inserted |= convert_regs_2 (file, e->dest);
|
2002-05-09 03:42:28 +02:00
|
|
|
|
|
|
|
|
|
/* ??? Process all unreachable blocks. Though there's no excuse
|
1999-10-27 03:25:13 +02:00
|
|
|
|
for keeping these even when not optimizing. */
|
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)
|
1999-10-27 03:25:13 +02:00
|
|
|
|
{
|
|
|
|
|
block_info bi = BLOCK_INFO (b);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
if (! bi->done)
|
1991-12-26 11:05:42 +01:00
|
|
|
|
{
|
1999-10-27 03:25:13 +02:00
|
|
|
|
int reg;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
/* Create an arbitrary input stack. */
|
|
|
|
|
bi->stack_in.top = -1;
|
|
|
|
|
for (reg = LAST_STACK_REG; reg >= FIRST_STACK_REG; --reg)
|
|
|
|
|
if (TEST_HARD_REG_BIT (bi->stack_in.reg_set, reg))
|
|
|
|
|
bi->stack_in.reg[++bi->stack_in.top] = reg;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
inserted |= convert_regs_2 (file, b);
|
|
|
|
|
}
|
|
|
|
|
}
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
2002-03-07 16:38:00 +01:00
|
|
|
|
fixup_abnormal_edges ();
|
1999-10-27 03:25:13 +02:00
|
|
|
|
if (inserted)
|
|
|
|
|
commit_edge_insertions ();
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
if (file)
|
|
|
|
|
fputc ('\n', file);
|
1991-12-26 11:05:42 +01:00
|
|
|
|
|
1999-10-27 03:25:13 +02:00
|
|
|
|
return inserted;
|
1991-12-26 11:05:42 +01:00
|
|
|
|
}
|
|
|
|
|
#endif /* STACK_REGS */
|
2002-06-04 09:11:05 +02:00
|
|
|
|
|
|
|
|
|
#include "gt-reg-stack.h"
|