1991-10-24 18:21:48 +01:00
|
|
|
|
/* Generate code from machine description to extract operands from insn as rtl.
|
attribs.c, [...]: Update copyright.
* attribs.c, c-pragma.c, caller-save.c, cfghooks.h,
coverage.c, cselib.h, domwalk.c, domwalk.h, errors.c,
errors.h, gcov-dump.c, gcov-io.c, gcov-io.h, gen-protos.c,
genattrtab.h, genextract.c, gthr-win32.h, insn-notes.def,
integrate.c, lambda-mat.c, lambda.h, libgcov.c, local-alloc.c,
machmode.def, mips-tfile.c, params.c, pretty-print.c,
print-rtl.c, protoize.c, regmove.c, sched-vis.c, tree-chrec.h,
tree-data-ref.h, vec.h, config/darwin-c.c, config/sol2-c.c,
config/sol2.c, config/arm/arm-cores.def, config/arm/cirrus.md,
config/arm/symbian.h, config/c4x/c4x.c, config/c4x/c4x.h,
config/i386/cygming.h, config/i386/djgpp.h,
config/i386/lynx.h, config/i386/netware.c,
config/i386/winnt.c, config/ia64/ia64-c.c,
config/iq2000/iq2000.c, config/m32r/little.h,
config/m68k/m68k-protos.h, config/m68k/m68k.h,
config/m68k/m68k.md, config/mcore/mcore.c,
config/mcore/mcore.h, config/mmix/mmix.c, config/mmix/mmix.md,
config/mn10300/mn10300-protos.h, config/mn10300/mn10300.c,
config/mn10300/mn10300.h, config/ns32k/netbsd.h,
config/ns32k/ns32k.c, config/ns32k/ns32k.h,
config/pa/pa-hpux11.h, config/pdp11/pdp11.c,
config/pdp11/pdp11.h, config/rs6000/darwin.h,
config/rs6000/default64.h, config/rs6000/rs6000-c.c,
config/s390/2064.md, config/s390/2084.md,
config/s390/s390-modes.def, config/s390/s390-protos.h,
config/s390/tpf.h, config/sh/sh.h, config/sh/symbian.c,
config/stormy16/stormy16.c, config/vax/vax-protos.h,
config/vax/vax.c, config/vax/vax.h,
config/xtensa/lib1funcs.asm, config/xtensa/xtensa.md: Update
copyright.
From-SVN: r98914
2005-04-28 07:38:50 +02:00
|
|
|
|
Copyright (C) 1987, 1991, 1992, 1993, 1997, 1998, 1999, 2000, 2003,
|
|
|
|
|
2004, 2005
|
2003-06-01 17:59:10 +02:00
|
|
|
|
Free Software Foundation, Inc.
|
1991-10-24 18:21:48 +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-10-24 18:21:48 +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 the Free
|
|
|
|
|
Software Foundation; either version 2, or (at your option) any later
|
|
|
|
|
version.
|
1991-10-24 18:21:48 +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-10-24 18:21:48 +01: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
|
2005-06-25 04:02:01 +02:00
|
|
|
|
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
|
|
|
|
|
02110-1301, USA. */
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
#include "bconfig.h"
|
Cutover various gen*.c files to using system.h:
* Makefile.in (genconfig.o, genflags.o, gencodes.o, genemit.o,
genopinit.o, genrecog.o, genextract.o, genpeep.o, genattr.o,
genattrtab.o, genoutput.o): Depend on system.h.
* genattr.c: Include system.h. Add arguments to various function
prototypes. Remove redundant prototype of read_rtx().
* genattrtab.c: Likewise.
* gencodes.c: Likewise.
* genconfig.c: Likewise.
* genemit.c: Likewise.
* genextract.c: Likewise.
* genflags.c: Likewise.
* genopinit.c: Likewise.
* genoutput.c: Likewise.
* genpeep.c: Likewise.
* genrecog.c: Likewise.
From-SVN: r18794
1998-03-24 11:16:53 +01:00
|
|
|
|
#include "system.h"
|
2002-12-16 19:23:00 +01:00
|
|
|
|
#include "coretypes.h"
|
|
|
|
|
#include "tm.h"
|
1991-10-24 18:21:48 +01:00
|
|
|
|
#include "rtl.h"
|
errors.c: New file...
1999-08-27 00:27 -0700 Zack Weinberg <zack@bitmover.com>
* errors.c: New file; defines functions error, warning, and
fatal, variables have_error and progname.
* errors.h: New file; prototypes and decls for stuff in errors.c.
* Makefile: Add rules to build errors.o and
$(HOST_PREFIX)errors.o. Link genconfig, gencodes, genemit,
genopinit, genrecog, genextract, genpeep, genattr, and
genoutput with errors.o. Add errors.h to deps of genconfig.o,
gencodes.o, genemit.o, genopinit.o, genrecog.o, genextract.o,
genpeep.o, genattr.o, and genoutput.o.
* genconfig.c, gencodes.c, genemit.c, genopinit.c, genrecog.c,
genextract.c, genpeep.c, genattr.c: Include errors.h. Don't
define or prototype fatal. Set progname at beginning of main.
* genoutput.c: Likewise, and don't define or prototype error
either.
From-SVN: r28925
1999-08-27 09:47:17 +02:00
|
|
|
|
#include "errors.h"
|
2000-05-03 19:45:26 +02:00
|
|
|
|
#include "gensupport.h"
|
2006-01-23 16:14:59 +01:00
|
|
|
|
#include "vec.h"
|
Makefile.in (tree-into-ssa.o, [...]): Depend on vecprim.h.
* Makefile.in (tree-into-ssa.o, tree-outof-ssa.o,
tree-ssa-live.o, tree-ssa-alias.o, function.o, df-problems.o,
global.o, cfglayout.o, lambda-code.o, reg-stack.o,
build/genextract.o): Depend on vecprim.h.
* cfglayout.c, df-problems.c, function.c, genextract.c,
global.c, lambda-code.c, reg-stack.c, tree-into-ssa.c,
tree-outof-ssa.c, tree-ssa-alias.c, tree-ssa-live.c: Include
vecprim.h.
* vecprim.h: New.
From-SVN: r112830
2006-04-10 21:26:18 +02:00
|
|
|
|
#include "vecprim.h"
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
1992-04-18 22:23:49 +02:00
|
|
|
|
/* This structure contains all the information needed to describe one
|
2003-06-01 17:59:10 +02:00
|
|
|
|
set of extractions methods. Each method may be used by more than
|
1992-04-18 22:23:49 +02:00
|
|
|
|
one pattern if the operands are in the same place.
|
|
|
|
|
|
|
|
|
|
The string for each operand describes that path to the operand and
|
|
|
|
|
contains `0' through `9' when going into an expression and `a' through
|
|
|
|
|
`z' when going into a vector. We assume here that only the first operand
|
|
|
|
|
of an rtl expression is a vector. genrecog.c makes the same assumption
|
|
|
|
|
(and uses the same representation) and it is currently true. */
|
|
|
|
|
|
2006-01-23 16:14:59 +01:00
|
|
|
|
typedef char *locstr;
|
|
|
|
|
|
1992-04-18 22:23:49 +02:00
|
|
|
|
struct extraction
|
|
|
|
|
{
|
2006-01-23 16:14:59 +01:00
|
|
|
|
unsigned int op_count;
|
|
|
|
|
unsigned int dup_count;
|
|
|
|
|
locstr *oplocs;
|
|
|
|
|
locstr *duplocs;
|
|
|
|
|
int *dupnums;
|
1992-04-18 22:23:49 +02:00
|
|
|
|
struct code_ptr *insns;
|
|
|
|
|
struct extraction *next;
|
|
|
|
|
};
|
|
|
|
|
|
2006-01-23 16:14:59 +01:00
|
|
|
|
/* Holds a single insn code that uses an extraction method. */
|
1992-04-18 22:23:49 +02:00
|
|
|
|
struct code_ptr
|
|
|
|
|
{
|
|
|
|
|
int insn_code;
|
|
|
|
|
struct code_ptr *next;
|
|
|
|
|
};
|
|
|
|
|
|
2006-01-23 16:14:59 +01:00
|
|
|
|
/* All extractions needed for this machine description. */
|
1992-04-18 22:23:49 +02:00
|
|
|
|
static struct extraction *extractions;
|
|
|
|
|
|
2006-01-23 16:14:59 +01:00
|
|
|
|
/* All insn codes for old-style peepholes. */
|
|
|
|
|
static struct code_ptr *peepholes;
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
2006-01-23 16:14:59 +01:00
|
|
|
|
/* This structure is used by gen_insn and walk_rtx to accumulate the
|
|
|
|
|
data that will be used to produce an extractions structure. */
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
2006-01-23 16:14:59 +01:00
|
|
|
|
DEF_VEC_P(locstr);
|
|
|
|
|
DEF_VEC_ALLOC_P(locstr,heap);
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
2006-01-23 16:14:59 +01:00
|
|
|
|
struct accum_extract
|
|
|
|
|
{
|
|
|
|
|
VEC(locstr,heap) *oplocs;
|
|
|
|
|
VEC(locstr,heap) *duplocs;
|
|
|
|
|
VEC(int,heap) *dupnums;
|
|
|
|
|
VEC(char,heap) *pathstr;
|
|
|
|
|
};
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
2006-01-23 16:14:59 +01:00
|
|
|
|
/* Forward declarations. */
|
|
|
|
|
static void walk_rtx (rtx, struct accum_extract *);
|
errors.c: New file...
1999-08-27 00:27 -0700 Zack Weinberg <zack@bitmover.com>
* errors.c: New file; defines functions error, warning, and
fatal, variables have_error and progname.
* errors.h: New file; prototypes and decls for stuff in errors.c.
* Makefile: Add rules to build errors.o and
$(HOST_PREFIX)errors.o. Link genconfig, gencodes, genemit,
genopinit, genrecog, genextract, genpeep, genattr, and
genoutput with errors.o. Add errors.h to deps of genconfig.o,
gencodes.o, genemit.o, genopinit.o, genrecog.o, genextract.o,
genpeep.o, genattr.o, and genoutput.o.
* genconfig.c, gencodes.c, genemit.c, genopinit.c, genrecog.c,
genextract.c, genpeep.c, genattr.c: Include errors.h. Don't
define or prototype fatal. Set progname at beginning of main.
* genoutput.c: Likewise, and don't define or prototype error
either.
From-SVN: r28925
1999-08-27 09:47:17 +02:00
|
|
|
|
|
1991-10-24 18:21:48 +01:00
|
|
|
|
static void
|
2006-01-23 16:14:59 +01:00
|
|
|
|
gen_insn (rtx insn, int insn_code_number)
|
1991-10-24 18:21:48 +01:00
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
int i;
|
2006-01-23 16:14:59 +01:00
|
|
|
|
unsigned int op_count, dup_count, j;
|
2001-10-11 05:16:15 +02:00
|
|
|
|
struct extraction *p;
|
|
|
|
|
struct code_ptr *link;
|
2006-01-23 16:14:59 +01:00
|
|
|
|
struct accum_extract acc;
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
2006-01-23 16:14:59 +01:00
|
|
|
|
acc.oplocs = VEC_alloc (locstr,heap, 10);
|
|
|
|
|
acc.duplocs = VEC_alloc (locstr,heap, 10);
|
|
|
|
|
acc.dupnums = VEC_alloc (int,heap, 10);
|
|
|
|
|
acc.pathstr = VEC_alloc (char,heap, 20);
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
|
|
|
|
/* Walk the insn's pattern, remembering at all times the path
|
|
|
|
|
down to the walking point. */
|
|
|
|
|
|
|
|
|
|
if (XVECLEN (insn, 1) == 1)
|
2006-01-23 16:14:59 +01:00
|
|
|
|
walk_rtx (XVECEXP (insn, 1, 0), &acc);
|
1991-10-24 18:21:48 +01:00
|
|
|
|
else
|
|
|
|
|
for (i = XVECLEN (insn, 1) - 1; i >= 0; i--)
|
|
|
|
|
{
|
2006-01-23 16:14:59 +01:00
|
|
|
|
VEC_safe_push (char,heap, acc.pathstr, 'a' + i);
|
|
|
|
|
walk_rtx (XVECEXP (insn, 1, i), &acc);
|
|
|
|
|
VEC_pop (char, acc.pathstr);
|
1991-10-24 18:21:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
2006-01-23 16:14:59 +01:00
|
|
|
|
link = XNEW (struct code_ptr);
|
1992-04-18 22:23:49 +02:00
|
|
|
|
link->insn_code = insn_code_number;
|
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* See if we find something that already had this extraction method. */
|
1992-04-18 22:23:49 +02:00
|
|
|
|
|
2006-01-23 16:14:59 +01:00
|
|
|
|
op_count = VEC_length (locstr, acc.oplocs);
|
|
|
|
|
dup_count = VEC_length (locstr, acc.duplocs);
|
|
|
|
|
gcc_assert (dup_count == VEC_length (int, acc.dupnums));
|
|
|
|
|
|
1992-04-18 22:23:49 +02:00
|
|
|
|
for (p = extractions; p; p = p->next)
|
1991-10-24 18:21:48 +01:00
|
|
|
|
{
|
1992-04-18 22:23:49 +02:00
|
|
|
|
if (p->op_count != op_count || p->dup_count != dup_count)
|
|
|
|
|
continue;
|
|
|
|
|
|
2006-01-23 16:14:59 +01:00
|
|
|
|
for (j = 0; j < op_count; j++)
|
|
|
|
|
{
|
|
|
|
|
char *a = p->oplocs[j];
|
|
|
|
|
char *b = VEC_index (locstr, acc.oplocs, j);
|
|
|
|
|
if (a != b && (!a || !b || strcmp (a, b)))
|
|
|
|
|
break;
|
|
|
|
|
}
|
1992-04-18 22:23:49 +02:00
|
|
|
|
|
2006-01-23 16:14:59 +01:00
|
|
|
|
if (j != op_count)
|
1992-04-18 22:23:49 +02:00
|
|
|
|
continue;
|
|
|
|
|
|
2006-01-23 16:14:59 +01:00
|
|
|
|
for (j = 0; j < dup_count; j++)
|
|
|
|
|
if (p->dupnums[j] != VEC_index (int, acc.dupnums, j)
|
|
|
|
|
|| strcmp (p->duplocs[j], VEC_index (locstr, acc.duplocs, j)))
|
1992-04-18 22:23:49 +02:00
|
|
|
|
break;
|
|
|
|
|
|
2006-01-23 16:14:59 +01:00
|
|
|
|
if (j != dup_count)
|
1992-04-18 22:23:49 +02:00
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
/* This extraction is the same as ours. Just link us in. */
|
|
|
|
|
link->next = p->insns;
|
|
|
|
|
p->insns = link;
|
2006-01-23 16:14:59 +01:00
|
|
|
|
goto done;
|
1991-10-24 18:21:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
2006-01-23 16:14:59 +01:00
|
|
|
|
/* Otherwise, make a new extraction method. We stash the arrays
|
|
|
|
|
after the extraction structure in memory. */
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
2006-01-23 16:14:59 +01:00
|
|
|
|
p = xmalloc (sizeof (struct extraction)
|
|
|
|
|
+ op_count*sizeof (char *)
|
|
|
|
|
+ dup_count*sizeof (char *)
|
|
|
|
|
+ dup_count*sizeof (int));
|
1992-04-18 22:23:49 +02:00
|
|
|
|
p->op_count = op_count;
|
|
|
|
|
p->dup_count = dup_count;
|
|
|
|
|
p->next = extractions;
|
|
|
|
|
extractions = p;
|
|
|
|
|
p->insns = link;
|
|
|
|
|
link->next = 0;
|
|
|
|
|
|
2006-01-23 16:14:59 +01:00
|
|
|
|
p->oplocs = (char **)((char *)p + sizeof (struct extraction));
|
|
|
|
|
p->duplocs = p->oplocs + op_count;
|
|
|
|
|
p->dupnums = (int *)(p->duplocs + dup_count);
|
1992-04-18 22:23:49 +02:00
|
|
|
|
|
2006-01-23 16:14:59 +01:00
|
|
|
|
memcpy(p->oplocs, VEC_address(locstr,acc.oplocs), op_count*sizeof(locstr));
|
|
|
|
|
memcpy(p->duplocs, VEC_address(locstr,acc.duplocs), dup_count*sizeof(locstr));
|
|
|
|
|
memcpy(p->dupnums, VEC_address(int, acc.dupnums), dup_count*sizeof(int));
|
|
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
VEC_free (locstr,heap, acc.oplocs);
|
|
|
|
|
VEC_free (locstr,heap, acc.duplocs);
|
|
|
|
|
VEC_free (int,heap, acc.dupnums);
|
|
|
|
|
VEC_free (char,heap, acc.pathstr);
|
1992-04-18 22:23:49 +02:00
|
|
|
|
}
|
|
|
|
|
|
2006-01-23 16:14:59 +01:00
|
|
|
|
/* Helper subroutine of walk_rtx: given a VEC(locstr), an index, and a
|
|
|
|
|
string, insert the string at the index, which should either already
|
|
|
|
|
exist and be NULL, or not yet exist within the vector. In the latter
|
|
|
|
|
case the vector is enlarged as appropriate. */
|
1991-10-24 18:21:48 +01:00
|
|
|
|
static void
|
2006-01-24 16:17:22 +01:00
|
|
|
|
VEC_safe_set_locstr (VEC(locstr,heap) **vp, unsigned int ix, char *str)
|
2006-01-23 16:14:59 +01:00
|
|
|
|
{
|
2006-01-24 16:17:22 +01:00
|
|
|
|
if (ix < VEC_length (locstr, *vp))
|
2006-01-23 16:14:59 +01:00
|
|
|
|
{
|
2006-01-24 16:17:22 +01:00
|
|
|
|
gcc_assert (VEC_index (locstr, *vp, ix) == 0);
|
|
|
|
|
VEC_replace (locstr, *vp, ix, str);
|
2006-01-23 16:14:59 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2006-01-24 16:17:22 +01:00
|
|
|
|
while (ix > VEC_length (locstr, *vp))
|
|
|
|
|
VEC_safe_push (locstr, heap, *vp, 0);
|
|
|
|
|
VEC_safe_push (locstr, heap, *vp, str);
|
2006-01-23 16:14:59 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Another helper subroutine of walk_rtx: given a VEC(char), convert it
|
|
|
|
|
to a NUL-terminated string in malloc memory. */
|
|
|
|
|
static char *
|
|
|
|
|
VEC_char_to_string (VEC(char,heap) *v)
|
|
|
|
|
{
|
|
|
|
|
size_t n = VEC_length (char, v);
|
2006-01-31 20:56:55 +01:00
|
|
|
|
char *s = XNEWVEC (char, n + 1);
|
2006-01-23 16:14:59 +01:00
|
|
|
|
memcpy (s, VEC_address (char, v), n);
|
|
|
|
|
s[n] = '\0';
|
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
walk_rtx (rtx x, struct accum_extract *acc)
|
1991-10-24 18:21:48 +01:00
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
RTX_CODE code;
|
2006-01-23 16:14:59 +01:00
|
|
|
|
int i, len, base;
|
2001-10-11 05:16:15 +02:00
|
|
|
|
const char *fmt;
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
|
|
|
|
if (x == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
code = GET_CODE (x);
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case PC:
|
|
|
|
|
case CC0:
|
|
|
|
|
case CONST_INT:
|
|
|
|
|
case SYMBOL_REF:
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case MATCH_OPERAND:
|
|
|
|
|
case MATCH_SCRATCH:
|
2006-01-24 16:17:22 +01:00
|
|
|
|
VEC_safe_set_locstr (&acc->oplocs, XINT (x, 0),
|
2006-01-23 16:14:59 +01:00
|
|
|
|
VEC_char_to_string (acc->pathstr));
|
1991-10-24 18:21:48 +01:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case MATCH_OPERATOR:
|
2006-01-23 16:14:59 +01:00
|
|
|
|
case MATCH_PARALLEL:
|
2006-01-24 16:17:22 +01:00
|
|
|
|
VEC_safe_set_locstr (&acc->oplocs, XINT (x, 0),
|
2006-01-23 16:14:59 +01:00
|
|
|
|
VEC_char_to_string (acc->pathstr));
|
1992-04-18 22:23:49 +02:00
|
|
|
|
|
2006-01-23 16:14:59 +01:00
|
|
|
|
base = (code == MATCH_OPERATOR ? '0' : 'a');
|
1991-10-24 18:21:48 +01:00
|
|
|
|
for (i = XVECLEN (x, 2) - 1; i >= 0; i--)
|
|
|
|
|
{
|
2006-01-23 16:14:59 +01:00
|
|
|
|
VEC_safe_push (char,heap, acc->pathstr, base + i);
|
|
|
|
|
walk_rtx (XVECEXP (x, 2, i), acc);
|
|
|
|
|
VEC_pop (char, acc->pathstr);
|
|
|
|
|
}
|
1991-10-24 18:21:48 +01:00
|
|
|
|
return;
|
|
|
|
|
|
2006-01-23 16:14:59 +01:00
|
|
|
|
case MATCH_DUP:
|
|
|
|
|
case MATCH_PAR_DUP:
|
|
|
|
|
case MATCH_OP_DUP:
|
|
|
|
|
VEC_safe_push (locstr,heap, acc->duplocs,
|
|
|
|
|
VEC_char_to_string (acc->pathstr));
|
|
|
|
|
VEC_safe_push (int,heap, acc->dupnums, XINT (x, 0));
|
1992-04-18 22:23:49 +02:00
|
|
|
|
|
2006-01-23 16:14:59 +01:00
|
|
|
|
if (code == MATCH_DUP)
|
|
|
|
|
break;
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
2006-01-23 16:14:59 +01:00
|
|
|
|
base = (code == MATCH_OP_DUP ? '0' : 'a');
|
|
|
|
|
for (i = XVECLEN (x, 1) - 1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
VEC_safe_push (char,heap, acc->pathstr, base + i);
|
|
|
|
|
walk_rtx (XVECEXP (x, 1, i), acc);
|
|
|
|
|
VEC_pop (char, acc->pathstr);
|
|
|
|
|
}
|
1991-10-24 18:21:48 +01:00
|
|
|
|
return;
|
c-common.c: Include <stdlib.h> and <string.h>/<strings.h>.
* c-common.c: Include <stdlib.h> and <string.h>/<strings.h>.
* calls.c (expand_call): Remove unused variables funtree,
n_regs, and tmpmode.
* dbxout.c, except.c: Include <string.h>/<strings.h>.
* explow.c: (plus_constant_for_output_wide) Removed unused
variable all_constant.
* c-decl.c, genattr.c, genattrtab.c, getconfig.c, genemit.c
genextract.c, genflags.c, genopinit.c genoutput.c, genpeep.c,
genrecog.c, global.c, integrate.c , stupid.c : Include
<stdlib.h>.
* genextract.c: (walk_rtx) Remove unused variable link.
* genrecog.c: (concat) Remove unreferenced static function.
* prefix.c: Include <string.h>/<strings.h>, <stdlib.h>
* stmt.c: Include <stdlib.h>.
(expand_asm_operands): Remove unused variable val1.
(expand_return): Remove unused variable block.
(pushcase): Remove unused variables l and n.
(pushcaserange): Likewise.
* unroll.c (unroll_loop): Remove unused variable temp.
From-SVN: r17766
1998-02-07 23:55:54 +01:00
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
1991-10-24 18:21:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fmt = GET_RTX_FORMAT (code);
|
|
|
|
|
len = GET_RTX_LENGTH (code);
|
|
|
|
|
for (i = 0; i < len; i++)
|
|
|
|
|
{
|
|
|
|
|
if (fmt[i] == 'e' || fmt[i] == 'u')
|
|
|
|
|
{
|
2006-01-23 16:14:59 +01:00
|
|
|
|
VEC_safe_push (char,heap, acc->pathstr, '0' + i);
|
|
|
|
|
walk_rtx (XEXP (x, i), acc);
|
|
|
|
|
VEC_pop (char, acc->pathstr);
|
1991-10-24 18:21:48 +01:00
|
|
|
|
}
|
|
|
|
|
else if (fmt[i] == 'E')
|
|
|
|
|
{
|
|
|
|
|
int j;
|
|
|
|
|
for (j = XVECLEN (x, i) - 1; j >= 0; j--)
|
|
|
|
|
{
|
2006-01-23 16:14:59 +01:00
|
|
|
|
VEC_safe_push (char,heap, acc->pathstr, 'a' + j);
|
|
|
|
|
walk_rtx (XVECEXP (x, i, j), acc);
|
|
|
|
|
VEC_pop (char, acc->pathstr);
|
1991-10-24 18:21:48 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Given a PATH, representing a path down the instruction's
|
|
|
|
|
pattern from the root to a certain point, output code to
|
|
|
|
|
evaluate to the rtx at that point. */
|
|
|
|
|
|
|
|
|
|
static void
|
2003-06-01 17:59:10 +02:00
|
|
|
|
print_path (const char *path)
|
1991-10-24 18:21:48 +01:00
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
int len = strlen (path);
|
|
|
|
|
int i;
|
1992-04-18 22:23:49 +02:00
|
|
|
|
|
1998-05-22 05:44:58 +02:00
|
|
|
|
if (len == 0)
|
|
|
|
|
{
|
|
|
|
|
/* Don't emit "pat", since we may try to take the address of it,
|
|
|
|
|
which isn't what is intended. */
|
2006-01-23 16:14:59 +01:00
|
|
|
|
fputs ("PATTERN (insn)", stdout);
|
1998-05-22 05:44:58 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
1992-04-18 22:23:49 +02:00
|
|
|
|
/* We first write out the operations (XEXP or XVECEXP) in reverse
|
2006-01-23 16:14:59 +01:00
|
|
|
|
order, then write "pat", then the indices in forward order. */
|
1992-04-18 22:23:49 +02:00
|
|
|
|
|
2003-03-15 14:43:33 +01:00
|
|
|
|
for (i = len - 1; i >= 0 ; i--)
|
1991-10-24 18:21:48 +01:00
|
|
|
|
{
|
2006-01-23 16:14:59 +01:00
|
|
|
|
if (ISLOWER (path[i]))
|
|
|
|
|
fputs ("XVECEXP (", stdout);
|
|
|
|
|
else if (ISDIGIT (path[i]))
|
|
|
|
|
fputs ("XEXP (", stdout);
|
1992-04-18 22:23:49 +02:00
|
|
|
|
else
|
Makefile.in (gengtype): Use $(BUILD_ERRORS).
* Makefile.in (gengtype): Use $(BUILD_ERRORS).
(gengtype.o): Depend on errors.h.
* genattrtab.c (strcmp_check): Use gcc_assert and gcc_unreachable.
(attr_rtx_1, attr_printf, attr_copy_rtx, evaluate_eq_attr,
attr_alt_subset_p, attr_alt_subset_of_compl_p,
attr_alt_intersection, attr_alt_union, optimize_attrs, gen_insn,
write_test_expr, write_attr_value, write_eligible_delay,
make_internal_attr, make_numeric_value): Likewise.
* genautomata.c (regexp_name, get_str_vect,
gen_presence_absence_set, automaton_decl_hash,
automaton_decl_eq_p, insn_decl_hash, insn_decl_eq_p, decl_hash,
decl_eq_p, process_regexp, loop_in_regexp, check_loops_in_regexps,
process_regexp_cycles, reserv_sets_cmp, set_unit_reserv,
test_unit_reserv, it_is_empty_reserv_sets,
reserv_sets_are_intersected, reserv_sets_shift, reserv_sets_or,
reserv_sets_and, output_cycle_reservs, get_free_state,
intersected_state_reservs_p, states_union, remove_arc,
copy_insn_regexp, transform_1, transform_2, transform_3,
regexp_transform_func, store_alt_unit_usage,
check_regexp_units_distribution, process_seq_for_forming_states,
process_alts_for_forming_states, make_automaton,
form_arcs_marked_by_insn, create_composed_state,
set_out_arc_insns_equiv_num, partition_equiv_class,
process_insn_equiv_class, set_insn_equiv_classes,
units_to_automata_heuristic_distr, form_regexp,
longest_path_length, output_dfa_max_issue_rate, add_vect,
out_state_arcs_num, add_vect_el, output_trans_table,
output_state_alts_table, output_dead_lock_vect,
output_max_insn_queue_index_def,
output_min_insn_conflict_delay_func,
output_internal_insn_latency_func, output_print_reservation_func,
output_cpu_unit_reservation_p, output_state_arcs,
make_insn_alts_attr, make_internal_dfa_insn_code_attr,
make_default_insn_latency_attr,
form_important_insn_automata_lists): Likewise.
* genemit.c (gen_exp, output_add_clobbers,
output_added_clobbers_hard_reg_p): Likewise.
* genextract.c (print_path, main): Likewise.
* genflags.c (gen_macro): Likewise.
* gengenrtl.c: Include errors.h
(type_from_format, accessor_from_format): Likewise.
* gengtype.c (get_file_basename, output_mangled_typename,
walk_type, write_types_process_field,
write_types_local_process_field): Likewise.
* genmodes.c (complete_mode): Likewise.
* genopinit.c (gen_insn): Likewise.
* genoutput.c (output_insn_data, check_constraint_len,
constraint_len): Likewise.
* genpreds.c (add_mode_tests):Likewise.
* gen-protos.c (add_hash): Likewise.
* genrecog.c (find_operand, find_matching_operand,
validate_pattern, add_to_sequence, maybe_both_true,
nodes_identical_1, merge_trees, write_switch, write_cond,
write_action, is_unconditional, make_insn_sequence,
debug_decision_2): Likewise.
* gensupport.c (is_predicable, collect_insn_data,
alter_predicate_for_insn, maybe_eval_c_test): Likewise.
From-SVN: r87236
2004-09-09 15:22:38 +02:00
|
|
|
|
gcc_unreachable ();
|
1991-10-24 18:21:48 +01:00
|
|
|
|
}
|
2003-06-01 17:59:10 +02:00
|
|
|
|
|
2006-01-23 16:14:59 +01:00
|
|
|
|
fputs ("pat", stdout);
|
1992-04-18 22:23:49 +02:00
|
|
|
|
|
|
|
|
|
for (i = 0; i < len; i++)
|
1991-10-24 18:21:48 +01:00
|
|
|
|
{
|
2006-01-23 16:14:59 +01:00
|
|
|
|
if (ISLOWER (path[i]))
|
1992-04-18 22:23:49 +02:00
|
|
|
|
printf (", 0, %d)", path[i] - 'a');
|
Linas Vepstas <linas@linas.org>
* c-common.c: Use ISGRAPH, ISLOWER, toupper.
* c-lex.c, cccp.c, cexp.c, cexp.y, cppexp.c, dwarf2out.c, genattr.c,
genattrtab.c, genemit.c, genextract.c, genpeep.c, tree.c: Likewise.
* system.h (IN_CTYPE_DOMAIN): Define to 1 if HOST_EBCDIC.
* defaults.h (TARGET_ESC): Add default.
From-SVN: r29192
1999-09-08 08:51:23 +02:00
|
|
|
|
else if (ISDIGIT(path[i]))
|
1992-04-18 22:23:49 +02:00
|
|
|
|
printf (", %d)", path[i] - '0');
|
|
|
|
|
else
|
Makefile.in (gengtype): Use $(BUILD_ERRORS).
* Makefile.in (gengtype): Use $(BUILD_ERRORS).
(gengtype.o): Depend on errors.h.
* genattrtab.c (strcmp_check): Use gcc_assert and gcc_unreachable.
(attr_rtx_1, attr_printf, attr_copy_rtx, evaluate_eq_attr,
attr_alt_subset_p, attr_alt_subset_of_compl_p,
attr_alt_intersection, attr_alt_union, optimize_attrs, gen_insn,
write_test_expr, write_attr_value, write_eligible_delay,
make_internal_attr, make_numeric_value): Likewise.
* genautomata.c (regexp_name, get_str_vect,
gen_presence_absence_set, automaton_decl_hash,
automaton_decl_eq_p, insn_decl_hash, insn_decl_eq_p, decl_hash,
decl_eq_p, process_regexp, loop_in_regexp, check_loops_in_regexps,
process_regexp_cycles, reserv_sets_cmp, set_unit_reserv,
test_unit_reserv, it_is_empty_reserv_sets,
reserv_sets_are_intersected, reserv_sets_shift, reserv_sets_or,
reserv_sets_and, output_cycle_reservs, get_free_state,
intersected_state_reservs_p, states_union, remove_arc,
copy_insn_regexp, transform_1, transform_2, transform_3,
regexp_transform_func, store_alt_unit_usage,
check_regexp_units_distribution, process_seq_for_forming_states,
process_alts_for_forming_states, make_automaton,
form_arcs_marked_by_insn, create_composed_state,
set_out_arc_insns_equiv_num, partition_equiv_class,
process_insn_equiv_class, set_insn_equiv_classes,
units_to_automata_heuristic_distr, form_regexp,
longest_path_length, output_dfa_max_issue_rate, add_vect,
out_state_arcs_num, add_vect_el, output_trans_table,
output_state_alts_table, output_dead_lock_vect,
output_max_insn_queue_index_def,
output_min_insn_conflict_delay_func,
output_internal_insn_latency_func, output_print_reservation_func,
output_cpu_unit_reservation_p, output_state_arcs,
make_insn_alts_attr, make_internal_dfa_insn_code_attr,
make_default_insn_latency_attr,
form_important_insn_automata_lists): Likewise.
* genemit.c (gen_exp, output_add_clobbers,
output_added_clobbers_hard_reg_p): Likewise.
* genextract.c (print_path, main): Likewise.
* genflags.c (gen_macro): Likewise.
* gengenrtl.c: Include errors.h
(type_from_format, accessor_from_format): Likewise.
* gengtype.c (get_file_basename, output_mangled_typename,
walk_type, write_types_process_field,
write_types_local_process_field): Likewise.
* genmodes.c (complete_mode): Likewise.
* genopinit.c (gen_insn): Likewise.
* genoutput.c (output_insn_data, check_constraint_len,
constraint_len): Likewise.
* genpreds.c (add_mode_tests):Likewise.
* gen-protos.c (add_hash): Likewise.
* genrecog.c (find_operand, find_matching_operand,
validate_pattern, add_to_sequence, maybe_both_true,
nodes_identical_1, merge_trees, write_switch, write_cond,
write_action, is_unconditional, make_insn_sequence,
debug_decision_2): Likewise.
* gensupport.c (is_predicable, collect_insn_data,
alter_predicate_for_insn, maybe_eval_c_test): Likewise.
From-SVN: r87236
2004-09-09 15:22:38 +02:00
|
|
|
|
gcc_unreachable ();
|
1991-10-24 18:21:48 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-01-23 16:14:59 +01:00
|
|
|
|
static void
|
|
|
|
|
print_header (void)
|
|
|
|
|
{
|
|
|
|
|
/* N.B. Code below avoids putting squiggle braces in column 1 inside
|
|
|
|
|
a string, because this confuses some editors' syntax highlighting
|
|
|
|
|
engines. */
|
|
|
|
|
|
|
|
|
|
puts ("\
|
|
|
|
|
/* Generated automatically by the program `genextract'\n\
|
|
|
|
|
from the machine description file `md'. */\n\
|
|
|
|
|
\n\
|
|
|
|
|
#include \"config.h\"\n\
|
|
|
|
|
#include \"system.h\"\n\
|
|
|
|
|
#include \"coretypes.h\"\n\
|
|
|
|
|
#include \"tm.h\"\n\
|
|
|
|
|
#include \"rtl.h\"\n\
|
|
|
|
|
#include \"insn-config.h\"\n\
|
|
|
|
|
#include \"recog.h\"\n\
|
|
|
|
|
#include \"toplev.h\"\n\
|
|
|
|
|
\n\
|
|
|
|
|
/* This variable is used as the \"location\" of any missing operand\n\
|
|
|
|
|
whose numbers are skipped by a given pattern. */\n\
|
|
|
|
|
static rtx junk ATTRIBUTE_UNUSED;\n");
|
|
|
|
|
|
|
|
|
|
puts ("\
|
|
|
|
|
void\n\
|
|
|
|
|
insn_extract (rtx insn)\n{\n\
|
|
|
|
|
rtx *ro = recog_data.operand;\n\
|
|
|
|
|
rtx **ro_loc = recog_data.operand_loc;\n\
|
|
|
|
|
rtx pat = PATTERN (insn);\n\
|
|
|
|
|
int i ATTRIBUTE_UNUSED; /* only for peepholes */\n\
|
|
|
|
|
\n\
|
|
|
|
|
#ifdef ENABLE_CHECKING\n\
|
|
|
|
|
memset (ro, 0xab, sizeof (*ro) * MAX_RECOG_OPERANDS);\n\
|
|
|
|
|
memset (ro_loc, 0xab, sizeof (*ro_loc) * MAX_RECOG_OPERANDS);\n\
|
|
|
|
|
#endif\n");
|
|
|
|
|
|
|
|
|
|
puts ("\
|
|
|
|
|
switch (INSN_CODE (insn))\n\
|
|
|
|
|
{\n\
|
|
|
|
|
default:\n\
|
|
|
|
|
/* Control reaches here if insn_extract has been called with an\n\
|
|
|
|
|
unrecognizable insn (code -1), or an insn whose INSN_CODE\n\
|
|
|
|
|
corresponds to a DEFINE_EXPAND in the machine description;\n\
|
|
|
|
|
either way, a bug. */\n\
|
|
|
|
|
if (INSN_CODE (insn) < 0)\n\
|
|
|
|
|
fatal_insn (\"unrecognizable insn:\", insn);\n\
|
|
|
|
|
else\n\
|
|
|
|
|
fatal_insn (\"insn with invalid code number:\", insn);\n");
|
|
|
|
|
}
|
1999-09-15 16:13:50 +02:00
|
|
|
|
|
1991-10-24 18:21:48 +01:00
|
|
|
|
int
|
2003-06-01 17:59:10 +02:00
|
|
|
|
main (int argc, char **argv)
|
1991-10-24 18:21:48 +01:00
|
|
|
|
{
|
|
|
|
|
rtx desc;
|
2006-01-23 16:14:59 +01:00
|
|
|
|
unsigned int i;
|
1992-04-18 22:23:49 +02:00
|
|
|
|
struct extraction *p;
|
|
|
|
|
struct code_ptr *link;
|
1999-11-12 20:48:14 +01:00
|
|
|
|
const char *name;
|
2006-01-23 16:14:59 +01:00
|
|
|
|
int insn_code_number;
|
|
|
|
|
int line_no;
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
errors.c: New file...
1999-08-27 00:27 -0700 Zack Weinberg <zack@bitmover.com>
* errors.c: New file; defines functions error, warning, and
fatal, variables have_error and progname.
* errors.h: New file; prototypes and decls for stuff in errors.c.
* Makefile: Add rules to build errors.o and
$(HOST_PREFIX)errors.o. Link genconfig, gencodes, genemit,
genopinit, genrecog, genextract, genpeep, genattr, and
genoutput with errors.o. Add errors.h to deps of genconfig.o,
gencodes.o, genemit.o, genopinit.o, genrecog.o, genextract.o,
genpeep.o, genattr.o, and genoutput.o.
* genconfig.c, gencodes.c, genemit.c, genopinit.c, genrecog.c,
genextract.c, genpeep.c, genattr.c: Include errors.h. Don't
define or prototype fatal. Set progname at beginning of main.
* genoutput.c: Likewise, and don't define or prototype error
either.
From-SVN: r28925
1999-08-27 09:47:17 +02:00
|
|
|
|
progname = "genextract";
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
2001-11-14 21:17:08 +01:00
|
|
|
|
if (init_md_reader_args (argc, argv) != SUCCESS_EXIT_CODE)
|
2000-05-03 19:45:26 +02:00
|
|
|
|
return (FATAL_EXIT_CODE);
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
|
|
|
|
/* Read the machine description. */
|
|
|
|
|
|
2006-01-23 16:14:59 +01:00
|
|
|
|
while ((desc = read_md_rtx (&line_no, &insn_code_number)) != NULL)
|
1991-10-24 18:21:48 +01:00
|
|
|
|
{
|
2000-05-03 19:45:26 +02:00
|
|
|
|
if (GET_CODE (desc) == DEFINE_INSN)
|
r110124@banpei: zack | 2006-01-22 14:45:55 -0800
r110124@banpei: zack | 2006-01-22 14:45:55 -0800
* gensupport.c: Define get_insn_name and record_insn_name here.
(read_md_rtx): Call record_insn_name as appropriate.
* genattr.c, genattrtab.c, gencodes.c, genconfig.c, genemit.c
* genextract.c, genflags.c, genopinit.c, genoutput.c, genpeep.c
* genpreds.c, genrecog.c: Don't define get_insn_name nor
record_insn_name.
* Makefile.in (BUILD_SUPPORT, BUILD_PRINT): Fold into BUILD_RTL.
(BUILD_VARRAY): Delete.
(genprognormal): Rename genprogmd. Fold in all programs from
genprognoprint; also attrtab.
(build/genattrtab): Just mention genautomata.o and varray.o.
Reorganize a bit, add comments to make the categories clearer.
From-SVN: r110120
2006-01-23 16:15:12 +01:00
|
|
|
|
gen_insn (desc, insn_code_number);
|
1992-04-18 22:23:49 +02:00
|
|
|
|
|
|
|
|
|
else if (GET_CODE (desc) == DEFINE_PEEPHOLE)
|
1991-10-24 18:21:48 +01:00
|
|
|
|
{
|
2006-01-31 20:56:55 +01:00
|
|
|
|
struct code_ptr *link = XNEW (struct code_ptr);
|
1992-04-18 22:23:49 +02:00
|
|
|
|
|
|
|
|
|
link->insn_code = insn_code_number;
|
|
|
|
|
link->next = peepholes;
|
|
|
|
|
peepholes = link;
|
1991-10-24 18:21:48 +01:00
|
|
|
|
}
|
1992-04-18 22:23:49 +02:00
|
|
|
|
}
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
2006-01-23 16:14:59 +01:00
|
|
|
|
print_header ();
|
|
|
|
|
|
1992-04-18 22:23:49 +02:00
|
|
|
|
/* Write out code to handle peepholes and the insn_codes that it should
|
|
|
|
|
be called for. */
|
|
|
|
|
if (peepholes)
|
1991-10-24 18:21:48 +01:00
|
|
|
|
{
|
1992-04-18 22:23:49 +02:00
|
|
|
|
for (link = peepholes; link; link = link->next)
|
|
|
|
|
printf (" case %d:\n", link->insn_code);
|
|
|
|
|
|
1991-10-24 18:21:48 +01:00
|
|
|
|
/* The vector in the insn says how many operands it has.
|
|
|
|
|
And all it contains are operands. In fact, the vector was
|
2001-11-24 23:57:28 +01:00
|
|
|
|
created just for the sake of this function. We need to set the
|
|
|
|
|
location of the operands for sake of simplifications after
|
|
|
|
|
extraction, like eliminating subregs. */
|
2006-01-23 16:14:59 +01:00
|
|
|
|
puts (" for (i = XVECLEN (pat, 0) - 1; i >= 0; i--)\n"
|
|
|
|
|
" ro[i] = *(ro_loc[i] = &XVECEXP (pat, 0, i));\n"
|
|
|
|
|
" break;\n");
|
1992-04-18 22:23:49 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Write out all the ways to extract insn operands. */
|
|
|
|
|
for (p = extractions; p; p = p->next)
|
|
|
|
|
{
|
|
|
|
|
for (link = p->insns; link; link = link->next)
|
1999-11-12 20:48:14 +01:00
|
|
|
|
{
|
|
|
|
|
i = link->insn_code;
|
|
|
|
|
name = get_insn_name (i);
|
|
|
|
|
if (name)
|
|
|
|
|
printf (" case %d: /* %s */\n", i, name);
|
|
|
|
|
else
|
|
|
|
|
printf (" case %d:\n", i);
|
|
|
|
|
}
|
2003-06-01 17:59:10 +02:00
|
|
|
|
|
1992-04-18 22:23:49 +02:00
|
|
|
|
for (i = 0; i < p->op_count; i++)
|
|
|
|
|
{
|
|
|
|
|
if (p->oplocs[i] == 0)
|
|
|
|
|
{
|
|
|
|
|
printf (" ro[%d] = const0_rtx;\n", i);
|
1993-04-13 23:19:54 +02:00
|
|
|
|
printf (" ro_loc[%d] = &junk;\n", i);
|
1992-04-18 22:23:49 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf (" ro[%d] = *(ro_loc[%d] = &", i, i);
|
|
|
|
|
print_path (p->oplocs[i]);
|
2006-01-23 16:14:59 +01:00
|
|
|
|
puts (");");
|
1992-04-18 22:23:49 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < p->dup_count; i++)
|
|
|
|
|
{
|
1999-09-12 03:51:28 +02:00
|
|
|
|
printf (" recog_data.dup_loc[%d] = &", i);
|
1992-04-18 22:23:49 +02:00
|
|
|
|
print_path (p->duplocs[i]);
|
2006-01-23 16:14:59 +01:00
|
|
|
|
puts (";");
|
1999-09-12 03:51:28 +02:00
|
|
|
|
printf (" recog_data.dup_num[%d] = %d;\n", i, p->dupnums[i]);
|
1992-04-18 22:23:49 +02:00
|
|
|
|
}
|
|
|
|
|
|
2006-01-23 16:14:59 +01:00
|
|
|
|
puts (" break;\n");
|
1991-10-24 18:21:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
2006-01-23 16:14:59 +01:00
|
|
|
|
puts (" }\n}");
|
1991-10-24 18:21:48 +01:00
|
|
|
|
fflush (stdout);
|
1999-09-15 16:13:50 +02:00
|
|
|
|
return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
|
1991-10-24 18:21:48 +01:00
|
|
|
|
}
|